[PATCH] D34392: [index] Nested class declarations should be annotated with the "specializationOf" relation if they pseudo-override a type in the base template

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 06:51:59 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305911: [index] Nested class declarations should be annotated with the (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D34392?vs=103179&id=103369#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34392

Files:
  cfe/trunk/lib/Index/IndexDecl.cpp
  cfe/trunk/test/Index/Core/index-source.cpp


Index: cfe/trunk/lib/Index/IndexDecl.cpp
===================================================================
--- cfe/trunk/lib/Index/IndexDecl.cpp
+++ cfe/trunk/lib/Index/IndexDecl.cpp
@@ -351,9 +351,11 @@
         IndexCtx.indexTagDecl(D, Relations);
       } else {
         auto *Parent = dyn_cast<NamedDecl>(D->getDeclContext());
+        SmallVector<SymbolRelation, 1> Relations;
+        gatherTemplatePseudoOverrides(D, Relations);
         return IndexCtx.handleReference(D, D->getLocation(), Parent,
                                         D->getLexicalDeclContext(),
-                                        SymbolRoleSet());
+                                        SymbolRoleSet(), Relations);
       }
     }
     return true;
Index: cfe/trunk/test/Index/Core/index-source.cpp
===================================================================
--- cfe/trunk/test/Index/Core/index-source.cpp
+++ cfe/trunk/test/Index/Core/index-source.cpp
@@ -134,6 +134,9 @@
 
   template<typename U> struct InnerTemplate { };
   template<typename U> struct InnerTemplate <U*> { };
+
+  template<typename U>
+  class InnerClass { };
 };
 
 template<>
@@ -195,8 +198,22 @@
 // CHECK-NEXT: RelChild
 // CHECK-NEXT: RelSpecialization | InnerTemplate | c:@ST>2#T#T at PseudoOverridesInSpecializations@ST>1#T at InnerTemplate
   template<typename U> struct InnerTemplate <U*> { };
+
+  template<typename U>
+  class InnerClass;
+// CHECK: [[@LINE-1]]:9 | class(Gen)/C++ | InnerClass | c:@S at PseudoOverridesInSpecializations>#d#I at ST>1#T at InnerClass | <no-cgname> | Ref,RelCont,RelSpecialization | rel: 2
+// CHECK-NEXT: RelCont
+// CHECK-NEXT: RelSpecialization | InnerClass | c:@ST>2#T#T at PseudoOverridesInSpecializations@ST>1#T at InnerClass
 };
 
+template<typename U>
+class PseudoOverridesInSpecializations<double, int>::InnerClass {
+};
+// CHECK: [[@LINE-2]]:54 | class(Gen)/C++ | InnerClass | c:@S at PseudoOverridesInSpecializations>#d#I at ST>1#T at InnerClass | <no-cgname> | Def,RelChild | rel: 1
+// CHECK-NEXT: RelChild
+// CHECK: [[@LINE-4]]:7 | class(Gen)/C++ | PseudoOverridesInSpecializations | c:@ST>2#T#T at PseudoOverridesInSpecializations | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK-NEXT: RelCont
+
 template<typename S>
 class PseudoOverridesInSpecializations<float, S> {
   typedef float TypealiasOrRecord;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34392.103369.patch
Type: text/x-patch
Size: 2302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170621/2c06c4ea/attachment.bin>


More information about the cfe-commits mailing list