https://github.com/lodha1503 updated https://github.com/llvm/llvm-project/pull/205408
>From 788a78fb0b95a2975d263eb593cb1efc58b82afc Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Wed, 24 Jun 2026 00:40:22 +0530 Subject: [PATCH 1/6] [Clang][AST] Add source range for deleted and defaulted functions --- clang/lib/Parse/Parser.cpp | 2 ++ .../AST/ast-dump-deleted-defaulted-range.cpp | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 clang/test/AST/ast-dump-deleted-defaulted-range.cpp diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 5e1fd4df1a3f0..6bf1315ede69b 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1308,12 +1308,14 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, << 1 /* deleted */; BodyKind = Sema::FnBodyKind::Delete; DeletedMessage = ParseCXXDeletedFunctionMessage(); + D.SetRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function : diag::ext_defaulted_deleted_function) << 0 /* defaulted */; BodyKind = Sema::FnBodyKind::Default; + D.SetRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); } diff --git a/clang/test/AST/ast-dump-deleted-defaulted-range.cpp b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp new file mode 100644 index 0000000000000..5eb0a5cecd778 --- /dev/null +++ b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++11 -ast-dump %s | FileCheck %s + +void delfunc() = delete; +// CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:23> col:6 delfunc 'void ()' delete + +struct S { + inline S(); +}; + +inline S::S() = default; +// CHECK: CXXConstructorDecl{{.*}} <line:[[@LINE-1]]:1, col:23>{{.*}}S 'void ()' inline default + +struct v { + void f() = delete; +}; +// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:3, col:19> col:8 f 'void ()' delete + +class Truck { + inline Truck(); +}; + +inline Truck::Truck() = default; +// CHECK: CXXConstructorDecl{{.*}} <line:[[@LINE-1]]:1, col:31>{{.*}}Truck 'void ()' inline default + +template <class T> void bubbleSort(T a[], int n) = delete; +// CHECK: FunctionTemplateDecl{{.*}} <line:[[@LINE-1]]:1, col:57> col:25 bubbleSort + +template <typename T> class Array { +public: + Array(T arr[], int s); + void print() = delete; +}; +// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:5, col:25> col:10 print 'void ()' delete >From 3ad87ceb3c750ac049f0dadb7b051a8952d53cdf Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Fri, 26 Jun 2026 20:33:47 +0530 Subject: [PATCH 2/6] Resolved Comments and fixed delete with message --- clang/lib/Parse/ParseCXXInlineMethods.cpp | 5 ++--- clang/lib/Parse/Parser.cpp | 2 +- .../AST/ast-dump-deleted-defaulted-range.cpp | 17 +++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 6189c854e5fbf..8c66d53aea0f4 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -101,7 +101,6 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( bool Delete = false; SourceLocation KWLoc; - SourceLocation KWEndLoc = Tok.getEndLoc().getLocWithOffset(-1); if (TryConsumeToken(tok::kw_delete, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function @@ -111,7 +110,7 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( Actions.SetDeclDeleted(FnD, KWLoc, Message); Delete = true; if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd(KWEndLoc); + DeclAsFunction->setRangeEnd( Message? PrevTokLocation : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 @@ -120,7 +119,7 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( << 0 /* defaulted */; Actions.SetDeclDefaulted(FnD, KWLoc); if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd(KWEndLoc); + DeclAsFunction->setRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 6bf1315ede69b..08b4181243a4b 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1308,7 +1308,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, << 1 /* deleted */; BodyKind = Sema::FnBodyKind::Delete; DeletedMessage = ParseCXXDeletedFunctionMessage(); - D.SetRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + D.SetRangeEnd(DeletedMessage? PrevTokLocation: PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function diff --git a/clang/test/AST/ast-dump-deleted-defaulted-range.cpp b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp index 5eb0a5cecd778..c2a18f1ce4d2e 100644 --- a/clang/test/AST/ast-dump-deleted-defaulted-range.cpp +++ b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -ast-dump %s | FileCheck %s +// RUN: %clang_cc1 -ast-dump %s | FileCheck %s void delfunc() = delete; // CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:23> col:6 delfunc 'void ()' delete @@ -15,13 +15,6 @@ struct v { }; // CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:3, col:19> col:8 f 'void ()' delete -class Truck { - inline Truck(); -}; - -inline Truck::Truck() = default; -// CHECK: CXXConstructorDecl{{.*}} <line:[[@LINE-1]]:1, col:31>{{.*}}Truck 'void ()' inline default - template <class T> void bubbleSort(T a[], int n) = delete; // CHECK: FunctionTemplateDecl{{.*}} <line:[[@LINE-1]]:1, col:57> col:25 bubbleSort @@ -31,3 +24,11 @@ template <typename T> class Array { void print() = delete; }; // CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:5, col:25> col:10 print 'void ()' delete + +void delfunc2() = delete("reason"); +// CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:34> col:6 delfunc2 'void ()' delete + +struct w { + void g() = delete("reason"); +}; +// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:3, col:29> col:8 g 'void ()' delete >From 228533290137e4f617be07ddc7010a73a474127a Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Sat, 27 Jun 2026 00:56:08 +0530 Subject: [PATCH 3/6] [Clang][AST] Update tests for extended source range of defaulted functions --- clang/test/CoverageMapping/default-method.cpp | 2 +- .../Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/test/CoverageMapping/default-method.cpp b/clang/test/CoverageMapping/default-method.cpp index beaac0db2fc78..4293d5c5dcf8e 100644 --- a/clang/test/CoverageMapping/default-method.cpp +++ b/clang/test/CoverageMapping/default-method.cpp @@ -11,7 +11,7 @@ namespace PR39822 { }; // CHECK: _ZN7PR398223fooaSERS0_: - // CHECK-NEXT: File 0, [[@LINE+1]]:28 -> [[@LINE+1]]:29 = #0 + // CHECK-NEXT: File 0, [[@LINE+1]]:38 -> [[@LINE+1]]:39 = #0 foo &foo::operator=(foo &) = default; } // namespace PR39822 diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp index 1eeb3df81a316..18de085973195 100644 --- a/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp +++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp @@ -34,9 +34,9 @@ TEST(RecursiveASTVisitor, CXXMethodDeclNoDefaultBodyVisited) { for (bool VisitImplCode : {false, true}) { CXXMethodDeclVisitor Visitor(VisitImplCode); if (VisitImplCode) - Visitor.ExpectMatch("declref", 8, 28); + Visitor.ExpectMatch("declref", 8, 38); else - Visitor.DisallowMatch("declref", 8, 28); + Visitor.DisallowMatch("declref", 8, 38); Visitor.ExpectMatch("parm", 8, 27); llvm::StringRef Code = R"cpp( >From efb823a78f19327f7173f56caf85746d6306118f Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Thu, 9 Jul 2026 15:36:19 +0530 Subject: [PATCH 4/6] clang-format: fix formatting in Parser and ParseCXXInlineMethods --- clang/lib/Parse/ParseCXXInlineMethods.cpp | 7 +++++-- clang/lib/Parse/Parser.cpp | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index c3013b6848883..77260755ac64e 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -110,7 +110,9 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( Actions.SetDeclDeleted(FnD, KWLoc, Message); Delete = true; if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd( Message? PrevTokLocation : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + DeclAsFunction->setRangeEnd( + Message ? PrevTokLocation + : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 @@ -119,7 +121,8 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( << 0 /* defaulted */; Actions.SetDeclDefaulted(FnD, KWLoc); if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + DeclAsFunction->setRangeEnd( + PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 08b4181243a4b..62b1a8a24c17f 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1308,7 +1308,9 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, << 1 /* deleted */; BodyKind = Sema::FnBodyKind::Delete; DeletedMessage = ParseCXXDeletedFunctionMessage(); - D.SetRangeEnd(DeletedMessage? PrevTokLocation: PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + D.SetRangeEnd(DeletedMessage + ? PrevTokLocation + : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function >From 63fb80e53510b156b15dc1266d01612250f69bea Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Sat, 11 Jul 2026 02:21:07 +0530 Subject: [PATCH 5/6] Fix macro-location crash in delete/default source range computation Replace the two-step getLocForEndOfToken().getLocWithOffset(-1) pattern with a single-step MeasureTokenLength-based offset in both the out-of-class (Parser.cpp) and in-class (ParseCXXInlineMethods.cpp) paths. The old approach could corrupt the macro-ID bit in SourceLocation when the delete/default keyword originated from a macro expansion, tripping an assertion (offset overflow) in SourceLocation::getLocWithOffset. Fixes CI failures in tests where '= delete' or '= default' comes from a macro (e.g. DISALLOW_COPY_AND_ASSIGN-style macros, CUDA/HIP builtin var headers, ODR-hash tests using macro-generated content). --- clang/lib/Parse/ParseCXXInlineMethods.cpp | 11 ++++++++--- clang/lib/Parse/Parser.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 77260755ac64e..22f09895c90fc 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -112,7 +112,10 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { DeclAsFunction->setRangeEnd( Message ? PrevTokLocation - : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + : KWLoc.getLocWithOffset( + Lexer::MeasureTokenLength( + KWLoc, PP.getSourceManager(), getLangOpts()) - + 1)); } } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 @@ -121,8 +124,10 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( << 0 /* defaulted */; Actions.SetDeclDefaulted(FnD, KWLoc); if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd( - PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + DeclAsFunction->setRangeEnd(KWLoc.getLocWithOffset( + Lexer::MeasureTokenLength(KWLoc, PP.getSourceManager(), + getLangOpts()) - + 1)); } } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 62b1a8a24c17f..b4854d82204cb 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1310,14 +1310,20 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, DeletedMessage = ParseCXXDeletedFunctionMessage(); D.SetRangeEnd(DeletedMessage ? PrevTokLocation - : PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + : KWLoc.getLocWithOffset( + Lexer::MeasureTokenLength( + KWLoc, PP.getSourceManager(), getLangOpts()) - + 1)); } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function : diag::ext_defaulted_deleted_function) << 0 /* defaulted */; BodyKind = Sema::FnBodyKind::Default; - D.SetRangeEnd(PP.getLocForEndOfToken(KWLoc).getLocWithOffset(-1)); + D.SetRangeEnd(KWLoc.getLocWithOffset( + Lexer::MeasureTokenLength(KWLoc, PP.getSourceManager(), + getLangOpts()) - + 1)); } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); } >From 5e4a77bf59223e9393ce2b9666eacfe911710d9e Mon Sep 17 00:00:00 2001 From: lodha1503 <[email protected]> Date: Thu, 16 Jul 2026 05:10:43 +0530 Subject: [PATCH 6/6] [clang] Switch to PrevTokLocation for delete/default range end, update tests --- clang/lib/Parse/ParseCXXInlineMethods.cpp | 12 ++-------- clang/lib/Parse/Parser.cpp | 12 ++-------- clang/test/AST/ast-dump-decl.cpp | 12 +++++----- .../AST/ast-dump-deleted-defaulted-range.cpp | 10 ++++---- clang/test/AST/ast-dump-funcs.cpp | 6 ++--- .../ast-dump-record-definition-data-json.cpp | 24 +++++++++---------- .../expected-plists/path-notes.cpp.plist | 6 ++--- clang/test/CoverageMapping/default-method.cpp | 2 +- clang/unittests/AST/SourceLocationTest.cpp | 4 ++-- .../CXXMethodDecl.cpp | 8 +++---- 10 files changed, 40 insertions(+), 56 deletions(-) diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 2d32b6d9b1df4..be531e567046e 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -110,12 +110,7 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( Actions.SetDeclDeleted(FnD, KWLoc, Message); Delete = true; if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd( - Message ? PrevTokLocation - : KWLoc.getLocWithOffset( - Lexer::MeasureTokenLength( - KWLoc, PP.getSourceManager(), getLangOpts()) - - 1)); + DeclAsFunction->setRangeEnd(PrevTokLocation); } } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 @@ -124,10 +119,7 @@ NamedDecl *Parser::ParseCXXInlineMethodDef( << 0 /* defaulted */; Actions.SetDeclDefaulted(FnD, KWLoc); if (auto *DeclAsFunction = dyn_cast<FunctionDecl>(FnD)) { - DeclAsFunction->setRangeEnd(KWLoc.getLocWithOffset( - Lexer::MeasureTokenLength(KWLoc, PP.getSourceManager(), - getLangOpts()) - - 1)); + DeclAsFunction->setRangeEnd(PrevTokLocation); } } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index b4854d82204cb..a95c54ac3dc5e 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1308,22 +1308,14 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, << 1 /* deleted */; BodyKind = Sema::FnBodyKind::Delete; DeletedMessage = ParseCXXDeletedFunctionMessage(); - D.SetRangeEnd(DeletedMessage - ? PrevTokLocation - : KWLoc.getLocWithOffset( - Lexer::MeasureTokenLength( - KWLoc, PP.getSourceManager(), getLangOpts()) - - 1)); + D.SetRangeEnd(PrevTokLocation); } else if (TryConsumeToken(tok::kw_default, KWLoc)) { Diag(KWLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_defaulted_deleted_function : diag::ext_defaulted_deleted_function) << 0 /* defaulted */; BodyKind = Sema::FnBodyKind::Default; - D.SetRangeEnd(KWLoc.getLocWithOffset( - Lexer::MeasureTokenLength(KWLoc, PP.getSourceManager(), - getLangOpts()) - - 1)); + D.SetRangeEnd(PrevTokLocation); } else { llvm_unreachable("function definition after = not 'delete' or 'default'"); } diff --git a/clang/test/AST/ast-dump-decl.cpp b/clang/test/AST/ast-dump-decl.cpp index 15c2e4e07e95c..ef5e0a55e431e 100644 --- a/clang/test/AST/ast-dump-decl.cpp +++ b/clang/test/AST/ast-dump-decl.cpp @@ -201,12 +201,12 @@ void SomeFunction() { A = static_cast<TestMemberRanges &&>(B); TestMemberRanges C(static_cast<TestMemberRanges &&>(A)); } -// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:30> -// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:59> -// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:54> -// CHECK: CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:31> -// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:70> -// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:65> +// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:24> +// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:53> +// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:48> +// CHECK: CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:25> +// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:64> +// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:59> class TestCXXConversionDecl { operator int() { return 0; } diff --git a/clang/test/AST/ast-dump-deleted-defaulted-range.cpp b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp index c2a18f1ce4d2e..0e6872d88a350 100644 --- a/clang/test/AST/ast-dump-deleted-defaulted-range.cpp +++ b/clang/test/AST/ast-dump-deleted-defaulted-range.cpp @@ -1,29 +1,29 @@ // RUN: %clang_cc1 -ast-dump %s | FileCheck %s void delfunc() = delete; -// CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:23> col:6 delfunc 'void ()' delete +// CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:18> col:6 delfunc 'void ()' delete struct S { inline S(); }; inline S::S() = default; -// CHECK: CXXConstructorDecl{{.*}} <line:[[@LINE-1]]:1, col:23>{{.*}}S 'void ()' inline default +// CHECK: CXXConstructorDecl{{.*}} <line:[[@LINE-1]]:1, col:17>{{.*}}S 'void ()' inline default struct v { void f() = delete; }; -// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:3, col:19> col:8 f 'void ()' delete +// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:3, col:14> col:8 f 'void ()' delete template <class T> void bubbleSort(T a[], int n) = delete; -// CHECK: FunctionTemplateDecl{{.*}} <line:[[@LINE-1]]:1, col:57> col:25 bubbleSort +// CHECK: FunctionTemplateDecl{{.*}} <line:[[@LINE-1]]:1, col:52> col:25 bubbleSort template <typename T> class Array { public: Array(T arr[], int s); void print() = delete; }; -// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:5, col:25> col:10 print 'void ()' delete +// CHECK: CXXMethodDecl{{.*}} <line:[[@LINE-2]]:5, col:20> col:10 print 'void ()' delete void delfunc2() = delete("reason"); // CHECK: FunctionDecl{{.*}} <{{.*}}[[@LINE-1]]:1, col:34> col:6 delfunc2 'void ()' delete diff --git a/clang/test/AST/ast-dump-funcs.cpp b/clang/test/AST/ast-dump-funcs.cpp index 61fb5d4eb654e..5779ab7271900 100644 --- a/clang/test/AST/ast-dump-funcs.cpp +++ b/clang/test/AST/ast-dump-funcs.cpp @@ -10,13 +10,13 @@ struct R { R() = default; - // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:15> col:3 used constexpr R 'void () noexcept' default trivial + // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9> col:3 used constexpr R 'void () noexcept' default trivial ~R() {} // not trivial // CHECK: CXXDestructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9> col:3 used ~R 'void () noexcept' R(const R&) = delete; - // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:22> col:3 R 'void (const R &)' delete trivial + // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:17> col:3 R 'void (const R &)' delete trivial R(R&&) = default; - // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:18> col:3 constexpr R 'void (R &&)' default trivial noexcept-unevaluated + // CHECK: CXXConstructorDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:12> col:3 constexpr R 'void (R &&)' default trivial noexcept-unevaluated // CHECK: CXXMethodDecl 0x{{[^ ]*}} <line:[[@LINE-10]]:8> col:8 implicit operator= 'R &(const R &)' inline default_delete trivial noexcept-unevaluated }; diff --git a/clang/test/AST/ast-dump-record-definition-data-json.cpp b/clang/test/AST/ast-dump-record-definition-data-json.cpp index d8ff6e980fb94..978b9e34f7b24 100644 --- a/clang/test/AST/ast-dump-record-definition-data-json.cpp +++ b/clang/test/AST/ast-dump-record-definition-data-json.cpp @@ -837,9 +837,9 @@ struct DoesNotAllowConstDefaultInit { // CHECK-NEXT: "tokLen": 18 // CHECK-NEXT: }, // CHECK-NEXT: "end": { -// CHECK-NEXT: "offset": 289, -// CHECK-NEXT: "col": 57, -// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: "offset": 283, +// CHECK-NEXT: "col": 51, +// CHECK-NEXT: "tokLen": 7 // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "CanPassInRegisters", @@ -980,9 +980,9 @@ struct DoesNotAllowConstDefaultInit { // CHECK-NEXT: "tokLen": 19 // CHECK-NEXT: }, // CHECK-NEXT: "end": { -// CHECK-NEXT: "offset": 382, -// CHECK-NEXT: "col": 58, -// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: "offset": 377, +// CHECK-NEXT: "col": 53, +// CHECK-NEXT: "tokLen": 6 // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "CantPassInRegisters", @@ -2547,9 +2547,9 @@ struct DoesNotAllowConstDefaultInit { // CHECK-NEXT: "tokLen": 9 // CHECK-NEXT: }, // CHECK-NEXT: "end": { -// CHECK-NEXT: "offset": 847, -// CHECK-NEXT: "col": 23, -// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: "offset": 841, +// CHECK-NEXT: "col": 17, +// CHECK-NEXT: "tokLen": 7 // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "IsTrivial", @@ -3747,9 +3747,9 @@ struct DoesNotAllowConstDefaultInit { // CHECK-NEXT: "tokLen": 1 // CHECK-NEXT: }, // CHECK-NEXT: "end": { -// CHECK-NEXT: "offset": 1126, -// CHECK-NEXT: "col": 24, -// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: "offset": 1120, +// CHECK-NEXT: "col": 18, +// CHECK-NEXT: "tokLen": 7 // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "~IsLiteral", diff --git a/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist b/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist index 62aaf0fe8e2d5..d93a1715491bc 100644 --- a/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist +++ b/clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist @@ -2223,7 +2223,7 @@ <array> <dict> <key>line</key><integer>105</integer> - <key>col</key><integer>63</integer> + <key>col</key><integer>57</integer> <key>file</key><integer>0</integer> </dict> <dict> @@ -2240,7 +2240,7 @@ <key>location</key> <dict> <key>line</key><integer>105</integer> - <key>col</key><integer>63</integer> + <key>col</key><integer>57</integer> <key>file</key><integer>0</integer> </dict> <key>ranges</key> @@ -2248,7 +2248,7 @@ <array> <dict> <key>line</key><integer>105</integer> - <key>col</key><integer>63</integer> + <key>col</key><integer>57</integer> <key>file</key><integer>0</integer> </dict> <dict> diff --git a/clang/test/CoverageMapping/default-method.cpp b/clang/test/CoverageMapping/default-method.cpp index 4293d5c5dcf8e..43db31f2110c6 100644 --- a/clang/test/CoverageMapping/default-method.cpp +++ b/clang/test/CoverageMapping/default-method.cpp @@ -11,7 +11,7 @@ namespace PR39822 { }; // CHECK: _ZN7PR398223fooaSERS0_: - // CHECK-NEXT: File 0, [[@LINE+1]]:38 -> [[@LINE+1]]:39 = #0 + // CHECK-NEXT: File 0, [[@LINE+1]]:32 -> [[@LINE+1]]:39 = #0 foo &foo::operator=(foo &) = default; } // namespace PR39822 diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp index 5b461d1cf4400..7bd0de04b2582 100644 --- a/clang/unittests/AST/SourceLocationTest.cpp +++ b/clang/unittests/AST/SourceLocationTest.cpp @@ -353,13 +353,13 @@ TEST(CXXConstructorDecl, NoRetFunTypeLocRange) { TEST(CXXConstructorDecl, DefaultedCtorLocRange) { RangeVerifier<CXXConstructorDecl> Verifier; - Verifier.expectRange(1, 11, 1, 23); + Verifier.expectRange(1, 11, 1, 17); EXPECT_TRUE(Verifier.match("class C { C() = default; };", functionDecl())); } TEST(CXXConstructorDecl, DeletedCtorLocRange) { RangeVerifier<CXXConstructorDecl> Verifier; - Verifier.expectRange(1, 11, 1, 22); + Verifier.expectRange(1, 11, 1, 17); EXPECT_TRUE(Verifier.match("class C { C() = delete; };", functionDecl())); } diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp index 18de085973195..0d155dbfcc74c 100644 --- a/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp +++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp @@ -34,9 +34,9 @@ TEST(RecursiveASTVisitor, CXXMethodDeclNoDefaultBodyVisited) { for (bool VisitImplCode : {false, true}) { CXXMethodDeclVisitor Visitor(VisitImplCode); if (VisitImplCode) - Visitor.ExpectMatch("declref", 8, 38); + Visitor.ExpectMatch("declref", 8, 32); else - Visitor.DisallowMatch("declref", 8, 38); + Visitor.DisallowMatch("declref", 8, 32); Visitor.ExpectMatch("parm", 8, 27); llvm::StringRef Code = R"cpp( @@ -56,9 +56,9 @@ TEST(RecursiveASTVisitor, FunctionDeclNoDefaultBodyVisited) { for (bool VisitImplCode : {false, true}) { CXXMethodDeclVisitor Visitor(VisitImplCode); if (VisitImplCode) - Visitor.ExpectMatch("declref", 4, 58, /*Times=*/2); + Visitor.ExpectMatch("declref", 4, 52, /*Times=*/2); else - Visitor.DisallowMatch("declref", 4, 58); + Visitor.DisallowMatch("declref", 4, 52); llvm::StringRef Code = R"cpp( struct s { int x; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
