[PATCH] D26849: [Sema] Set range end of constructors and destructors in template instantiations

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 03:21:42 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL288025: [Sema] Set range end of constructors and destructors in template instantiations (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D26849?vs=78522&id=79385#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26849

Files:
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/test/Misc/ast-dump-decl.cpp


Index: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1871,11 +1871,13 @@
                                         Constructor->isExplicit(),
                                         Constructor->isInlineSpecified(),
                                         false, Constructor->isConstexpr());
+    Method->setRangeEnd(Constructor->getLocEnd());
   } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
     Method = CXXDestructorDecl::Create(SemaRef.Context, Record,
                                        StartLoc, NameInfo, T, TInfo,
                                        Destructor->isInlineSpecified(),
                                        false);
+    Method->setRangeEnd(Destructor->getLocEnd());
   } else if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) {
     Method = CXXConversionDecl::Create(SemaRef.Context, Record,
                                        StartLoc, NameInfo, T, TInfo,
Index: cfe/trunk/test/Misc/ast-dump-decl.cpp
===================================================================
--- cfe/trunk/test/Misc/ast-dump-decl.cpp
+++ cfe/trunk/test/Misc/ast-dump-decl.cpp
@@ -223,6 +223,10 @@
   class D { };
 
   template<typename T> class TestClassTemplate {
+  public:
+    TestClassTemplate();
+    ~TestClassTemplate();
+    int j();
     int i;
   };
 
@@ -252,10 +256,18 @@
 // CHECK-NEXT:   TemplateTypeParmDecl
 // CHECK-NEXT:   CXXRecordDecl{{.*}} class TestClassTemplate
 // CHECK-NEXT:     CXXRecordDecl{{.*}} class TestClassTemplate
+// CHECK-NEXT:     AccessSpecDecl{{.*}} public
+// CHECK-NEXT:     CXXConstructorDecl{{.*}} <line:{{.*}}:5, col:23>
+// CHECK-NEXT:     CXXDestructorDecl{{.*}} <line:{{.*}}:5, col:24>
+// CHECK-NEXT:     CXXMethodDecl{{.*}} <line:{{.*}}:5, col:11>
 // CHECK-NEXT:     FieldDecl{{.*}} i
 // CHECK-NEXT:   ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
 // CHECK-NEXT:     TemplateArgument{{.*}}A
 // CHECK-NEXT:     CXXRecordDecl{{.*}} class TestClassTemplate
+// CHECK-NEXT:     AccessSpecDecl{{.*}} public
+// CHECK-NEXT:     CXXConstructorDecl{{.*}} <line:{{.*}}:5, col:23>
+// CHECK-NEXT:     CXXDestructorDecl{{.*}} <line:{{.*}}:5, col:24>
+// CHECK-NEXT:     CXXMethodDecl{{.*}} <line:{{.*}}:5, col:11>
 // CHECK-NEXT:     FieldDecl{{.*}} i
 // CHECK:        ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
 // CHECK-NEXT:   ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
@@ -269,11 +281,19 @@
 // CHECK:      ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
 // CHECK-NEXT:   TemplateArgument{{.*}}C
 // CHECK-NEXT:   CXXRecordDecl{{.*}} class TestClassTemplate
+// CHECK-NEXT:   AccessSpecDecl{{.*}} public
+// CHECK-NEXT:   CXXConstructorDecl{{.*}} <line:{{.*}}:5, col:23>
+// CHECK-NEXT:   CXXDestructorDecl{{.*}} <line:{{.*}}:5, col:24>
+// CHECK-NEXT:   CXXMethodDecl{{.*}} <line:{{.*}}:5, col:11>
 // CHECK-NEXT:   FieldDecl{{.*}} i
 
 // CHECK:      ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
 // CHECK-NEXT:   TemplateArgument{{.*}}D
 // CHECK-NEXT:   CXXRecordDecl{{.*}} class TestClassTemplate
+// CHECK-NEXT:   AccessSpecDecl{{.*}} public
+// CHECK-NEXT:   CXXConstructorDecl{{.*}} <line:{{.*}}:5, col:23>
+// CHECK-NEXT:   CXXDestructorDecl{{.*}} <line:{{.*}}:5, col:24>
+// CHECK-NEXT:   CXXMethodDecl{{.*}} <line:{{.*}}:5, col:11>
 // CHECK-NEXT:   FieldDecl{{.*}} i
 
 // CHECK:      ClassTemplatePartialSpecializationDecl{{.*}} class TestClassTemplatePartial


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26849.79385.patch
Type: text/x-patch
Size: 3647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161128/6f886632/attachment.bin>


More information about the cfe-commits mailing list