r302136 - [Index] The relation between the declarations in template

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Thu May 4 03:42:08 PDT 2017


Author: arphaman
Date: Thu May  4 05:42:06 2017
New Revision: 302136

URL: http://llvm.org/viewvc/llvm-project?rev=302136&view=rev
Log:
[Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

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

Modified: cfe/trunk/lib/Index/IndexDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexDecl.cpp?rev=302136&r1=302135&r2=302136&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexDecl.cpp (original)
+++ cfe/trunk/lib/Index/IndexDecl.cpp Thu May  4 05:42:06 2017
@@ -184,9 +184,7 @@ public:
             continue;
         }
         Relations.emplace_back(
-            SymbolRoleSet(SymbolRole::RelationOverrideOf) |
-                SymbolRoleSet(SymbolRole::RelationSpecializationOf),
-            ND);
+            SymbolRoleSet(SymbolRole::RelationSpecializationOf), ND);
       }
     }
   }

Modified: cfe/trunk/test/Index/Core/index-source.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.cpp?rev=302136&r1=302135&r2=302136&view=diff
==============================================================================
--- cfe/trunk/test/Index/Core/index-source.cpp (original)
+++ cfe/trunk/test/Index/Core/index-source.cpp Thu May  4 05:42:06 2017
@@ -139,13 +139,13 @@ class PseudoOverridesInSpecializations {
 template<>
 class PseudoOverridesInSpecializations<double, int> {
   void function() { }
-// CHECK: [[@LINE-1]]:8 | instance-method/C++ | function | c:@S at PseudoOverridesInSpecializations>#d#I at F@function# | __ZN32PseudoOverridesInSpecializationsIdiE8functionEv | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:8 | instance-method/C++ | function | c:@S at PseudoOverridesInSpecializations>#d#I at F@function# | __ZN32PseudoOverridesInSpecializationsIdiE8functionEv | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | function | c:@ST>2#T#T at PseudoOverridesInSpecializations@F at function#
+// CHECK-NEXT: RelSpecialization | function | c:@ST>2#T#T at PseudoOverridesInSpecializations@F at function#
 
   void staticFunction() { }
 // CHECK: [[@LINE-1]]:8 | instance-method/C++ | staticFunction | c:@S at PseudoOverridesInSpecializations>#d#I at F@staticFunction# | __ZN32PseudoOverridesInSpecializationsIdiE14staticFunctionEv | Def,RelChild | rel: 1
-// CHECK-NOT: RelOver
+// CHECK-NOT: RelSpecialization
 
   int notOverridingField = 0;
 
@@ -153,57 +153,56 @@ class PseudoOverridesInSpecializations<d
   int checLabelBreak = 0;
 
   int field = 0;
-// CHECK: [[@LINE-1]]:7 | field/C++ | field | c:@S at PseudoOverridesInSpecializations>#d#I at FI@field | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:7 | field/C++ | field | c:@S at PseudoOverridesInSpecializations>#d#I at FI@field | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | field | c:@ST>2#T#T at PseudoOverridesInSpecializations@FI at field
+// CHECK-NEXT: RelSpecialization | field | c:@ST>2#T#T at PseudoOverridesInSpecializations@FI at field
 
   static double variable;
-// CHECK: [[@LINE-1]]:17 | static-property/C++ | variable | c:@S at PseudoOverridesInSpecializations>#d#I at variable | __ZN32PseudoOverridesInSpecializationsIdiE8variableE | Decl,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:17 | static-property/C++ | variable | c:@S at PseudoOverridesInSpecializations>#d#I at variable | __ZN32PseudoOverridesInSpecializationsIdiE8variableE | Decl,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | variable | c:@ST>2#T#T at PseudoOverridesInSpecializations@variable
+// CHECK-NEXT: RelSpecialization | variable | c:@ST>2#T#T at PseudoOverridesInSpecializations@variable
 
   typedef double TypeDef;
-// CHECK: [[@LINE-1]]:18 | type-alias/C | TypeDef | c:index-source.cpp at S@PseudoOverridesInSpecializations>#d#I at T@TypeDef | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:18 | type-alias/C | TypeDef | c:index-source.cpp at S@PseudoOverridesInSpecializations>#d#I at T@TypeDef | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | TypeDef | c:index-source.cpp at ST>2#T#T at PseudoOverridesInSpecializations@T at TypeDef
+// CHECK-NEXT: RelSpecialization | TypeDef | c:index-source.cpp at ST>2#T#T at PseudoOverridesInSpecializations@T at TypeDef
 
   using TypeAlias = int;
-// CHECK: [[@LINE-1]]:9 | type-alias/C++ | TypeAlias | c:@S at PseudoOverridesInSpecializations>#d#I at TypeAlias | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:9 | type-alias/C++ | TypeAlias | c:@S at PseudoOverridesInSpecializations>#d#I at TypeAlias | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | TypeAlias | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypeAlias
+// CHECK-NEXT: RelSpecialization | TypeAlias | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypeAlias
 
   enum anEnum { };
-// CHECK: [[@LINE-1]]:8 | enum/C | anEnum | c:@S at PseudoOverridesInSpecializations>#d#I at E@anEnum | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:8 | enum/C | anEnum | c:@S at PseudoOverridesInSpecializations>#d#I at E@anEnum | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | anEnum | c:@ST>2#T#T at PseudoOverridesInSpecializations@E at anEnum
+// CHECK-NEXT: RelSpecialization | anEnum | c:@ST>2#T#T at PseudoOverridesInSpecializations@E at anEnum
   class Struct { };
-// CHECK: [[@LINE-1]]:9 | class/C++ | Struct | c:@S at PseudoOverridesInSpecializations>#d#I at S@Struct | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:9 | class/C++ | Struct | c:@S at PseudoOverridesInSpecializations>#d#I at S@Struct | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | Struct | c:@ST>2#T#T at PseudoOverridesInSpecializations@S at Struct
+// CHECK-NEXT: RelSpecialization | Struct | c:@ST>2#T#T at PseudoOverridesInSpecializations@S at Struct
   union Union { };
-// CHECK: [[@LINE-1]]:9 | union/C | Union | c:@S at PseudoOverridesInSpecializations>#d#I at U@Union | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:9 | union/C | Union | c:@S at PseudoOverridesInSpecializations>#d#I at U@Union | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | Union | c:@ST>2#T#T at PseudoOverridesInSpecializations@U at Union
+// CHECK-NEXT: RelSpecialization | Union | c:@ST>2#T#T at PseudoOverridesInSpecializations@U at Union
 
   struct TypealiasOrRecord { };
-// CHECK: [[@LINE-1]]:10 | struct/C | TypealiasOrRecord | c:@S at PseudoOverridesInSpecializations>#d#I at S@TypealiasOrRecord | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:10 | struct/C | TypealiasOrRecord | c:@S at PseudoOverridesInSpecializations>#d#I at S@TypealiasOrRecord | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | TypealiasOrRecord | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypealiasOrRecord
+// CHECK-NEXT: RelSpecialization | TypealiasOrRecord | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypealiasOrRecord
 
   template<typename U> struct InnerTemplate { };
-// CHECK: [[@LINE-1]]:31 | struct(Gen)/C++ | InnerTemplate | c:@S at PseudoOverridesInSpecializations>#d#I at ST>1#T at InnerTemplate | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:31 | struct(Gen)/C++ | InnerTemplate | c:@S at PseudoOverridesInSpecializations>#d#I at ST>1#T at InnerTemplate | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | InnerTemplate | c:@ST>2#T#T at PseudoOverridesInSpecializations@ST>1#T at InnerTemplate
+// CHECK-NEXT: RelSpecialization | InnerTemplate | c:@ST>2#T#T at PseudoOverridesInSpecializations@ST>1#T at InnerTemplate
   template<typename U> struct InnerTemplate <U*> { };
-// CHECK-NOT: RelOver
 };
 
 template<typename S>
 class PseudoOverridesInSpecializations<float, S> {
   typedef float TypealiasOrRecord;
-// CHECK: [[@LINE-1]]:17 | type-alias/C | TypealiasOrRecord | c:index-source.cpp at SP>1#T at PseudoOverridesInSpecializations>#f#t0.0 at T@TypealiasOrRecord | <no-cgname> | Def,RelChild,RelOver,RelSpecialization | rel: 2
+// CHECK: [[@LINE-1]]:17 | type-alias/C | TypealiasOrRecord | c:index-source.cpp at SP>1#T at PseudoOverridesInSpecializations>#f#t0.0 at T@TypealiasOrRecord | <no-cgname> | Def,RelChild,RelSpecialization | rel: 2
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | TypealiasOrRecord | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypealiasOrRecord
+// CHECK-NEXT: RelSpecialization | TypealiasOrRecord | c:@ST>2#T#T at PseudoOverridesInSpecializations@TypealiasOrRecord
 };
 
 template<typename T, typename U>
@@ -215,10 +214,10 @@ class ConflictingPseudoOverridesInSpecia
 template<typename T>
 class ConflictingPseudoOverridesInSpecialization<int, T> {
   void foo(T x);
-// CHECK: [[@LINE-1]]:8 | instance-method/C++ | foo | c:@SP>1#T at ConflictingPseudoOverridesInSpecialization>#I#t0.0 at F@foo#S0_# | <no-cgname> | Decl,RelChild,RelOver,RelSpecialization | rel: 3
+// CHECK: [[@LINE-1]]:8 | instance-method/C++ | foo | c:@SP>1#T at ConflictingPseudoOverridesInSpecialization>#I#t0.0 at F@foo#S0_# | <no-cgname> | Decl,RelChild,RelSpecialization | rel: 3
 // CHECK-NEXT: RelChild
-// CHECK-NEXT: RelOver,RelSpecialization | foo | c:@ST>2#T#T at ConflictingPseudoOverridesInSpecialization@F at foo#t0.0#
-// CHECK-NEXT: RelOver,RelSpecialization | foo | c:@ST>2#T#T at ConflictingPseudoOverridesInSpecialization@F at foo#t0.1#
+// CHECK-NEXT: RelSpecialization | foo | c:@ST>2#T#T at ConflictingPseudoOverridesInSpecialization@F at foo#t0.0#
+// CHECK-NEXT: RelSpecialization | foo | c:@ST>2#T#T at ConflictingPseudoOverridesInSpecialization@F at foo#t0.1#
 };
 
 template<typename T, typename U, int x>




More information about the cfe-commits mailing list