Author: ykiko Date: 2024-12-10T14:01:40+08:00 New Revision: 77a08a73cc57679e7bf30fdd8974aeba468f2a27
URL: https://github.com/llvm/llvm-project/commit/77a08a73cc57679e7bf30fdd8974aeba468f2a27 DIFF: https://github.com/llvm/llvm-project/commit/77a08a73cc57679e7bf30fdd8974aeba468f2a27.diff LOG: [Clang] Fix wrong call location of `DefaultArgExpr` (#119212) Fix https://github.com/llvm/llvm-project/issues/119129. Added: Modified: clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/source_location.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp index ed9079092f6ac9..50b6d4c5676c35 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp @@ -26,7 +26,7 @@ void S::x(int i = 12) {} int main() { S s; s.x(); - // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] + // CHECK-NOTES: [[@LINE-1]]:5: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] // CHECK-NOTES: [[@LINE-6]]:11: note: default parameter was declared here // CHECK-NEXT: void S::x(int i = 12) {} x(); diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index c040a0d80d0df3..7afd8dfd181953 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -698,6 +698,8 @@ Bug Fixes to Compiler Builtins - Fix ``__has_builtin`` incorrectly returning ``false`` for some C++ type traits. (#GH111477) +- Fix ``__builtin_source_location`` incorrectly returning wrong column for method chains. (#GH119129) + Bug Fixes to Attribute Support ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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; diff --git a/clang/test/SemaCXX/source_location.cpp b/clang/test/SemaCXX/source_location.cpp index 8b3a5d8dd3327d..069a9004927a9f 100644 --- a/clang/test/SemaCXX/source_location.cpp +++ b/clang/test/SemaCXX/source_location.cpp @@ -1012,3 +1012,21 @@ int h = Var<int>; } + +namespace GH119129 { +struct X{ + constexpr int foo(std::source_location loc = std::source_location::current()) { + return loc.line(); + } +}; +static_assert(X{}.foo() == __LINE__); +static_assert(X{}. + foo() == __LINE__); +static_assert(X{}. + + + foo() == __LINE__); +#line 10000 +static_assert(X{}. + foo() == 10001); +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits