Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor uses of Cand->Function in SemaOverload.cpp #98942

Closed
shafik opened this issue Jul 15, 2024 · 5 comments
Closed

Refactor uses of Cand->Function in SemaOverload.cpp #98942

shafik opened this issue Jul 15, 2024 · 5 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" code-cleanup good first issue https://github.com/llvm/llvm-project/contribute

Comments

@shafik
Copy link
Collaborator

shafik commented Jul 15, 2024

We use Cand->Function all over SemaOverload.cpp e.g.

https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L12583-L12585

In some places it is safe to use without checking b/c in the calling function we checked it prior. It is hard to see that without carefully checking the call chain.

It seems like once we check Cand->Function we should pass it as a separate FunctionDecl* argument and assert on that argument or at minimum we should assert on Cand->Function in the called function.

@shafik shafik added good first issue https://github.com/llvm/llvm-project/contribute code-cleanup labels Jul 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 15, 2024

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 has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
  2. In the comments of this issue, request for it to be assigned to you, 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.
  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.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 15, 2024

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

Author: Shafik Yaghmour (shafik)

We use `Cand->Function` all over `SemaOverload.cpp` e.g.

https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L12583-L12585

In some places it is safe to use without checking b/c in the calling function we checked it prior. It is hard to see that without carefully checking the call chain.

It seems like once we check Cand->Function we should pass it as a separate FunctionDecl* argument and assert on that argument or at minimum we should assert on Cand->Function in the called function.

@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Jul 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 15, 2024

@llvm/issue-subscribers-clang-frontend

Author: Shafik Yaghmour (shafik)

We use `Cand->Function` all over `SemaOverload.cpp` e.g.

https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaOverload.cpp#L12583-L12585

In some places it is safe to use without checking b/c in the calling function we checked it prior. It is hard to see that without carefully checking the call chain.

It seems like once we check Cand->Function we should pass it as a separate FunctionDecl* argument and assert on that argument or at minimum we should assert on Cand->Function in the called function.

@vortex73
Copy link
Contributor

Since this is basically a superset of #98769 i shall submit a combined PR.

shafik pushed a commit that referenced this issue Jul 24, 2024
- [ ] adds checks to called functions containing `Cand->Function` as an
argument.
- [ ] Assigned `Cand->Function` as a `FunctionDecl*` to enhance
readablity.
Solves: #98769 and #98942
yuxuanchen1997 pushed a commit that referenced this issue Jul 25, 2024
Summary:
- [ ] adds checks to called functions containing `Cand->Function` as an
argument.
- [ ] Assigned `Cand->Function` as a `FunctionDecl*` to enhance
readablity.
Solves: #98769 and #98942

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250569
@zyn0217
Copy link
Contributor

zyn0217 commented Oct 1, 2024

Fixed by #98965

@zyn0217 zyn0217 closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" code-cleanup good first issue https://github.com/llvm/llvm-project/contribute
Projects
None yet
Development

No branches or pull requests

5 participants