[cfe-commits] r131295 - in /cfe/trunk: test/Index/annotate-context-sensitive.cpp test/Index/overrides.cpp test/Index/recursive-cxx-member-calls.cpp tools/c-index-test/c-index-test.c

Douglas Gregor dgregor at apple.com
Fri May 13 08:54:42 PDT 2011


Author: dgregor
Date: Fri May 13 10:54:42 2011
New Revision: 131295

URL: http://llvm.org/viewvc/llvm-project?rev=131295&view=rev
Log:
Add c-index-test printing and tests for static and virtual method
query functions, from Erik Verbruggen!

Modified:
    cfe/trunk/test/Index/annotate-context-sensitive.cpp
    cfe/trunk/test/Index/overrides.cpp
    cfe/trunk/test/Index/recursive-cxx-member-calls.cpp
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/test/Index/annotate-context-sensitive.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-context-sensitive.cpp?rev=131295&r1=131294&r2=131295&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-context-sensitive.cpp (original)
+++ cfe/trunk/test/Index/annotate-context-sensitive.cpp Fri May 13 10:54:42 2011
@@ -28,12 +28,12 @@
 // CHECK-OVERRIDE-FINAL: Identifier: "Base" [6:30 - 6:34] TypeRef=class Base:1:7
 // CHECK-OVERRIDE-FINAL: Punctuation: "{" [6:35 - 6:36] ClassDecl=Derived:6:7 (Definition)
 // CHECK-OVERRIDE-FINAL: Keyword: "virtual" [7:3 - 7:10] ClassDecl=Derived:6:7 (Definition)
-// CHECK-OVERRIDE-FINAL: Keyword: "void" [7:11 - 7:15] CXXMethod=f:7:16 [Overrides @3:16]
-// CHECK-OVERRIDE-FINAL: Identifier: "f" [7:16 - 7:17] CXXMethod=f:7:16 [Overrides @3:16]
-// CHECK-OVERRIDE-FINAL: Punctuation: "(" [7:17 - 7:18] CXXMethod=f:7:16 [Overrides @3:16]
-// CHECK-OVERRIDE-FINAL: Punctuation: ")" [7:18 - 7:19] CXXMethod=f:7:16 [Overrides @3:16]
-// CHECK-OVERRIDE-FINAL: Keyword: "override" [7:20 - 7:28] CXXMethod=f:7:16 [Overrides @3:16]
-// CHECK-OVERRIDE-FINAL: Keyword: "final" [7:29 - 7:34] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Keyword: "void" [7:11 - 7:15] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Identifier: "f" [7:16 - 7:17] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Punctuation: "(" [7:17 - 7:18] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Punctuation: ")" [7:18 - 7:19] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Keyword: "override" [7:20 - 7:28] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Keyword: "final" [7:29 - 7:34] CXXMethod=f:7:16 (virtual) [Overrides @3:16]
 // CHECK-OVERRIDE-FINAL: Punctuation: ";" [7:34 - 7:35] ClassDecl=Derived:6:7 (Definition)
 // CHECK-OVERRIDE-FINAL: Keyword: "struct" [9:3 - 9:9] StructDecl=final:9:10 (Definition)
 // CHECK-OVERRIDE-FINAL: Identifier: "final" [9:10 - 9:15] StructDecl=final:9:10 (Definition)

Modified: cfe/trunk/test/Index/overrides.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/overrides.cpp?rev=131295&r1=131294&r2=131295&view=diff
==============================================================================
--- cfe/trunk/test/Index/overrides.cpp (original)
+++ cfe/trunk/test/Index/overrides.cpp Fri May 13 10:54:42 2011
@@ -16,5 +16,5 @@
 };
 
 // RUN: c-index-test -test-load-source local %s | FileCheck %s
-// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 [Overrides @7:16] Extent=[11:3 - 11:19]
-// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 [Overrides @2:16, @6:16] Extent=[15:3 - 15:22]
+// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 (virtual) [Overrides @7:16] Extent=[11:3 - 11:19]
+// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 (virtual) [Overrides @2:16, @6:16] Extent=[15:3 - 15:22]

Modified: cfe/trunk/test/Index/recursive-cxx-member-calls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/recursive-cxx-member-calls.cpp?rev=131295&r1=131294&r2=131295&view=diff
==============================================================================
--- cfe/trunk/test/Index/recursive-cxx-member-calls.cpp (original)
+++ cfe/trunk/test/Index/recursive-cxx-member-calls.cpp Fri May 13 10:54:42 2011
@@ -399,13 +399,13 @@
 // CHECK-tokens: Punctuation: ";" [32:6 - 32:7] ClassDecl=AttributeList:12:9 (Definition)
 // CHECK-tokens: Keyword: "static" [33:5 - 33:11] ClassDecl=AttributeList:12:9 (Definition)
 // CHECK-tokens: Identifier: "Kind" [33:12 - 33:16] TypeRef=enum clang::AttributeList::Kind:13:10
-// CHECK-tokens: Identifier: "getKind" [33:17 - 33:24] CXXMethod=getKind:33:17
-// CHECK-tokens: Punctuation: "(" [33:24 - 33:25] CXXMethod=getKind:33:17
-// CHECK-tokens: Keyword: "const" [33:25 - 33:30] CXXMethod=getKind:33:17
+// CHECK-tokens: Identifier: "getKind" [33:17 - 33:24] CXXMethod=getKind:33:17 (static)
+// CHECK-tokens: Punctuation: "(" [33:24 - 33:25] CXXMethod=getKind:33:17 (static)
+// CHECK-tokens: Keyword: "const" [33:25 - 33:30] CXXMethod=getKind:33:17 (static)
 // CHECK-tokens: Identifier: "IdentifierInfo" [33:31 - 33:45] TypeRef=class clang::IdentifierInfo:66:7
 // CHECK-tokens: Punctuation: "*" [33:46 - 33:47] ParmDecl=Name:33:48 (Definition)
 // CHECK-tokens: Identifier: "Name" [33:48 - 33:52] ParmDecl=Name:33:48 (Definition)
-// CHECK-tokens: Punctuation: ")" [33:52 - 33:53] CXXMethod=getKind:33:17
+// CHECK-tokens: Punctuation: ")" [33:52 - 33:53] CXXMethod=getKind:33:17 (static)
 // CHECK-tokens: Punctuation: ";" [33:53 - 33:54] ClassDecl=AttributeList:12:9 (Definition)
 // CHECK-tokens: Punctuation: "}" [34:3 - 34:4] ClassDecl=AttributeList:12:9 (Definition)
 // CHECK-tokens: Punctuation: ";" [34:4 - 34:5] Namespace=clang:10:17 (Definition)
@@ -456,14 +456,14 @@
 // CHECK-tokens: Punctuation: ";" [44:16 - 44:17] ClassDecl=StringRef:38:7 (Definition)
 // CHECK-tokens: Keyword: "static" [45:3 - 45:9] ClassDecl=StringRef:38:7 (Definition)
 // CHECK-tokens: Identifier: "size_t" [45:10 - 45:16] TypeRef=size_t:2:25
-// CHECK-tokens: Identifier: "min" [45:17 - 45:20] CXXMethod=min:45:17 (Definition)
-// CHECK-tokens: Punctuation: "(" [45:20 - 45:21] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Identifier: "min" [45:17 - 45:20] CXXMethod=min:45:17 (Definition) (static)
+// CHECK-tokens: Punctuation: "(" [45:20 - 45:21] CXXMethod=min:45:17 (Definition) (static)
 // CHECK-tokens: Identifier: "size_t" [45:21 - 45:27] TypeRef=size_t:2:25
 // CHECK-tokens: Identifier: "a" [45:28 - 45:29] ParmDecl=a:45:28 (Definition)
-// CHECK-tokens: Punctuation: "," [45:29 - 45:30] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Punctuation: "," [45:29 - 45:30] CXXMethod=min:45:17 (Definition) (static)
 // CHECK-tokens: Identifier: "size_t" [45:31 - 45:37] TypeRef=size_t:2:25
 // CHECK-tokens: Identifier: "b" [45:38 - 45:39] ParmDecl=b:45:38 (Definition)
-// CHECK-tokens: Punctuation: ")" [45:39 - 45:40] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Punctuation: ")" [45:39 - 45:40] CXXMethod=min:45:17 (Definition) (static)
 // CHECK-tokens: Punctuation: "{" [45:41 - 45:42] UnexposedStmt=
 // CHECK-tokens: Keyword: "return" [45:43 - 45:49] UnexposedStmt=
 // CHECK-tokens: Identifier: "a" [45:50 - 45:51] DeclRefExpr=a:45:28
@@ -893,17 +893,17 @@
 // CHECK-tokens: Identifier: "clang" [98:17 - 98:22] NamespaceRef=clang:10:17
 // CHECK-tokens: Punctuation: ";" [98:22 - 98:23]
 // CHECK-tokens: Identifier: "AttributeList" [100:1 - 100:14] TypeRef=class clang::AttributeList:12:9
-// CHECK-tokens: Punctuation: "::" [100:14 - 100:16] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Punctuation: "::" [100:14 - 100:16] CXXMethod=getKind:100:36 (Definition) (static)
 // CHECK-tokens: Identifier: "Kind" [100:16 - 100:20] TypeRef=enum clang::AttributeList::Kind:13:10
 // CHECK-tokens: Identifier: "AttributeList" [100:21 - 100:34] TypeRef=class clang::AttributeList:12:9
-// CHECK-tokens: Punctuation: "::" [100:34 - 100:36] CXXMethod=getKind:100:36 (Definition)
-// CHECK-tokens: Identifier: "getKind" [100:36 - 100:43] CXXMethod=getKind:100:36 (Definition)
-// CHECK-tokens: Punctuation: "(" [100:43 - 100:44] CXXMethod=getKind:100:36 (Definition)
-// CHECK-tokens: Keyword: "const" [100:44 - 100:49] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Punctuation: "::" [100:34 - 100:36] CXXMethod=getKind:100:36 (Definition) (static)
+// CHECK-tokens: Identifier: "getKind" [100:36 - 100:43] CXXMethod=getKind:100:36 (Definition) (static)
+// CHECK-tokens: Punctuation: "(" [100:43 - 100:44] CXXMethod=getKind:100:36 (Definition) (static)
+// CHECK-tokens: Keyword: "const" [100:44 - 100:49] CXXMethod=getKind:100:36 (Definition) (static)
 // CHECK-tokens: Identifier: "IdentifierInfo" [100:50 - 100:64] TypeRef=class clang::IdentifierInfo:66:7
 // CHECK-tokens: Punctuation: "*" [100:65 - 100:66] ParmDecl=Name:100:67 (Definition)
 // CHECK-tokens: Identifier: "Name" [100:67 - 100:71] ParmDecl=Name:100:67 (Definition)
-// CHECK-tokens: Punctuation: ")" [100:71 - 100:72] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Punctuation: ")" [100:71 - 100:72] CXXMethod=getKind:100:36 (Definition) (static)
 // CHECK-tokens: Punctuation: "{" [100:73 - 100:74] UnexposedStmt=
 // CHECK-tokens: Identifier: "llvm" [101:3 - 101:7] NamespaceRef=llvm:82:11
 // CHECK-tokens: Punctuation: "::" [101:7 - 101:9] VarDecl=AttrName:101:19 (Definition)
@@ -1616,7 +1616,7 @@
 // CHECK: 30:40: EnumConstantDecl=AT_init_priority:30:40 (Definition) Extent=[30:40 - 30:56]
 // CHECK: 31:7: EnumConstantDecl=IgnoredAttribute:31:7 (Definition) Extent=[31:7 - 31:23]
 // CHECK: 31:25: EnumConstantDecl=UnknownAttribute:31:25 (Definition) Extent=[31:25 - 31:41]
-// CHECK: 33:17: CXXMethod=getKind:33:17 Extent=[33:5 - 33:53]
+// CHECK: 33:17: CXXMethod=getKind:33:17 (static) Extent=[33:5 - 33:53]
 // CHECK: 33:12: TypeRef=enum clang::AttributeList::Kind:13:10 Extent=[33:12 - 33:16]
 // CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:25 - 33:52]
 // CHECK: 33:31: TypeRef=class clang::IdentifierInfo:66:7 Extent=[33:31 - 33:45]
@@ -1638,7 +1638,7 @@
 // CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:3 - 43:19]
 // CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:3 - 44:16]
 // CHECK: 44:3: TypeRef=size_t:2:25 Extent=[44:3 - 44:9]
-// CHECK: 45:17: CXXMethod=min:45:17 (Definition) Extent=[45:3 - 45:66]
+// CHECK: 45:17: CXXMethod=min:45:17 (Definition) (static) Extent=[45:3 - 45:66]
 // CHECK: 45:10: TypeRef=size_t:2:25 Extent=[45:10 - 45:16]
 // CHECK: 45:28: ParmDecl=a:45:28 (Definition) Extent=[45:21 - 45:29]
 // CHECK: 45:21: TypeRef=size_t:2:25 Extent=[45:21 - 45:27]
@@ -1865,7 +1865,7 @@
 // CHECK: 93:12: DeclRefExpr=Value:92:23 Extent=[93:12 - 93:17]
 // CHECK: 98:17: UsingDirective=:98:17 Extent=[98:1 - 98:22]
 // CHECK: 98:17: NamespaceRef=clang:10:17 Extent=[98:17 - 98:22]
-// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) Extent=[100:1 - 186:2]
+// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) (static) Extent=[100:1 - 186:2]
 // CHECK: 100:21: TypeRef=class clang::AttributeList:12:9 Extent=[100:21 - 100:34]
 // CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:44 - 100:71]
 // CHECK: 100:50: TypeRef=class clang::IdentifierInfo:66:7 Extent=[100:50 - 100:64]

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=131295&r1=131294&r2=131295&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Fri May 13 10:54:42 2011
@@ -221,6 +221,11 @@
         break;
     }
     
+    if (clang_CXXMethod_isStatic(Cursor))
+      printf(" (static)");
+    if (clang_CXXMethod_isVirtual(Cursor))
+      printf(" (virtual)");
+    
     if (Cursor.kind == CXCursor_IBOutletCollectionAttr) {
       CXType T =
         clang_getCanonicalType(clang_getIBOutletCollectionType(Cursor));





More information about the cfe-commits mailing list