https://github.com/16bit-ykiko updated https://github.com/llvm/llvm-project/pull/119212
>From 64dcfdfd0a87d6ca5bfcfe5f5a8e5204c24a26d2 Mon Sep 17 00:00:00 2001 From: ykiko <ykikoykikoyk...@gmail.com> Date: Mon, 9 Dec 2024 21:56:58 +0800 Subject: [PATCH 1/4] Fix call location of `DefaultArgExpr`. --- clang/lib/Sema/SemaExpr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; >From 07475f1289ea30c7d228ba448c4a5071d4b672ea Mon Sep 17 00:00:00 2001 From: ykiko <ykikoykikoyk...@gmail.com> Date: Mon, 9 Dec 2024 22:26:04 +0800 Subject: [PATCH 2/4] Add release note and test. --- clang/docs/ReleaseNotes.rst | 2 ++ clang/test/SemaCXX/source_location.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 7d846f1d447d16..785bacef67a65d 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/test/SemaCXX/source_location.cpp b/clang/test/SemaCXX/source_location.cpp index 8b3a5d8dd3327d..f62b9627ec0592 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); +} \ No newline at end of file >From e253d079b2b964c71c8e406229ac74079b76b1be Mon Sep 17 00:00:00 2001 From: ykiko <ykikoykikoyk...@gmail.com> Date: Mon, 9 Dec 2024 22:34:20 +0800 Subject: [PATCH 3/4] Add eof. --- clang/test/SemaCXX/source_location.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/test/SemaCXX/source_location.cpp b/clang/test/SemaCXX/source_location.cpp index f62b9627ec0592..069a9004927a9f 100644 --- a/clang/test/SemaCXX/source_location.cpp +++ b/clang/test/SemaCXX/source_location.cpp @@ -1021,12 +1021,12 @@ struct X{ }; static_assert(X{}.foo() == __LINE__); static_assert(X{}. - foo() ==__LINE__); + foo() == __LINE__); static_assert(X{}. - foo() ==__LINE__); + foo() == __LINE__); #line 10000 static_assert(X{}. foo() == 10001); -} \ No newline at end of file +} >From bce250452e13c101d94f6e07135878fe91a2ebe5 Mon Sep 17 00:00:00 2001 From: ykiko <ykikoykikoyk...@gmail.com> Date: Mon, 9 Dec 2024 23:59:44 +0800 Subject: [PATCH 4/4] Sync changes in tidy. --- .../clang-tidy/checkers/fuchsia/default-arguments-calls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits