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 ed9079092f6ac..50b6d4c5676c3 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 7d846f1d447d1..785bacef67a65 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -695,6 +695,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 14564b99de44c..9b543d6484b85 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5948,7 +5948,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, SmallVector 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 8b3a5d8dd3327..069a9004927a9 100644 --- a/clang/test/SemaCXX/source_location.cpp +++ b/clang/test/SemaCXX/source_location.cpp @@ -1012,3 +1012,21 @@ int h = Var; } + +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); +}