llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Clang][OpenMP] Add missing check in ParseOpenMPClause

Open TPPPP72 opened this issue 4 months ago • 7 comments

As what we have discussed in #200663, we need to add some check before calling Act function ParseOpenMPClause in the file clang/lib/Parse/ParseOpenMP.cpp.

If someone picks this up, I think it would be a great "good first issue." And if there are no open associated PRs for this issue after a week, I will complete and close it myself.

TPPPP72 avatar Jul 29 '26 14:07 TPPPP72

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
  2. Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally. Be aware that LLVM's AI policy forbids the use of AI tools to fix good first issues since it squanders a learning opportunity. Using LLMs to search and learn is permitted, since the goal is learning.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

@llvm/issue-subscribers-good-first-issue

Author: Shengxin Pei (TPPPP72)

As what we have discussed in #200663, we need to add some check before calling `Act` function `ParseOpenMPClause` in the file `clang/lib/Parse/ParseOpenMP.cpp`.

If someone picks this up, I think it would be a great "good first issue." And if there are no open associated PRs for this issue after a week, I will complete and close it myself.

@llvm/issue-subscribers-clang-frontend

Author: Shengxin Pei (TPPPP72)

As what we have discussed in #200663, we need to add some check before calling `Act` function `ParseOpenMPClause` in the file `clang/lib/Parse/ParseOpenMP.cpp`.

If someone picks this up, I think it would be a great "good first issue." And if there are no open associated PRs for this issue after a week, I will complete and close it myself.

Hi,I want to take this. Assign me please. Any extra context appreciated.

ABWI-Y avatar Jul 29 '26 14:07 ABWI-Y

@ABWI-Y Thank you for your participation. We typically do not assign issues directly; opening a PR is considered as claiming the issue.

TPPPP72 avatar Jul 29 '26 14:07 TPPPP72

@TPPPP72 The two remaining unguarded Act* calls in ParseOpenMPClause look like ActOnOpenMPDirectivePresenceClause (absent/contains) and ActOnOpenMPNullaryAssumptionClause (no_openmp etc.) — but unlike the transparent case, neither of those asserts or diagnoses, and WrongDirective always implies ErrorFound — so the clause is discarded either way and I can't produce a -verify test that shows a difference. Do you want this as a no-functional-change consistency fix without a test, or is there a case I'm missing where these actually misbehave??

OHNope avatar Jul 29 '26 15:07 OHNope

@TPPPP72 The two remaining unguarded Act* calls in ParseOpenMPClause look like ActOnOpenMPDirectivePresenceClause (absent/contains) and ActOnOpenMPNullaryAssumptionClause (no_openmp etc.) — but unlike the transparent case, neither of those asserts or diagnoses, and WrongDirective always implies ErrorFound — so the clause is discarded either way and I can't produce a -verify test that shows a difference. Do you want this as a no-functional-change consistency fix without a test, or is there a case I'm missing where these actually misbehave??

It should be a NFC PR cuz current tests have not covered these paths. If there's a reviewer saying that you should add a test to avoid regression, you can just add to the PR related to this issue. I think it's unnecessary :D

TPPPP72 avatar Jul 29 '26 16:07 TPPPP72