Skip to content

[Clang] Fix wrong call location of DefaultArgExpr. #119212

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

Merged
merged 5 commits into from
Dec 10, 2024

Conversation

16bit-ykiko
Copy link
Contributor

Fix #119129.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2024

@llvm/pr-subscribers-clang-tools-extra
@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-clang

Author: ykiko (16bit-ykiko)

Changes

Fix #119129.


Full diff: https://github.com/llvm/llvm-project/pull/119212.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaExpr.cpp (+1-1)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 14564b99de44c5..9b543d6484b85c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5948,7 +5948,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
   SmallVector<Expr *, 8> AllArgs;
   VariadicCallType CallType = getVariadicCallType(FDecl, Proto, Fn);
 
-  Invalid = GatherArgumentsForCall(Call->getBeginLoc(), FDecl, Proto, 0, Args,
+  Invalid = GatherArgumentsForCall(Call->getExprLoc(), FDecl, Proto, 0, Args,
                                    AllArgs, CallType);
   if (Invalid)
     return true;

@cor3ntin
Copy link
Contributor

cor3ntin commented Dec 9, 2024

This looks reasonable but needs tests (you could adapt #119129 to to make foo a constexpr function returning the line number, and checking that. use #line 4242 to make the test less susceptible to lines changes.

A changelog entry would be useful too

Copy link
Contributor

@cor3ntin cor3ntin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo nit

@zyn0217 zyn0217 merged commit 77a08a7 into llvm:main Dec 10, 2024
11 checks passed
@16bit-ykiko 16bit-ykiko deleted the fix-source-location-current branch December 24, 2024 12:49
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" clang Clang issues not falling into any other category clang-tidy clang-tools-extra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[[Clang]] Unexpected source location in method chaining
4 participants