[cfe-commits] r90193 - in /cfe/trunk: test/Index/c-index-api-fn-scan.m test/Index/c-index-api-loadTU-test.m tools/c-index-test/c-index-test.c
Daniel Dunbar
daniel at zuster.org
Mon Nov 30 18:35:38 PST 2009
Author: ddunbar
Date: Mon Nov 30 20:35:37 2009
New Revision: 90193
URL: http://llvm.org/viewvc/llvm-project?rev=90193&view=rev
Log:
c-index-test: Split "function scanning" behavior into its own "filter" -- its
quite slow and doesn't really stress the APIs people should really use.
- I'm not even sure if this mode is still useful given the other scanning mode;
Steve?
Added:
cfe/trunk/test/Index/c-index-api-fn-scan.m
Modified:
cfe/trunk/test/Index/c-index-api-loadTU-test.m
cfe/trunk/tools/c-index-test/c-index-test.c
Added: cfe/trunk/test/Index/c-index-api-fn-scan.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-api-fn-scan.m?rev=90193&view=auto
==============================================================================
--- cfe/trunk/test/Index/c-index-api-fn-scan.m (added)
+++ cfe/trunk/test/Index/c-index-api-fn-scan.m Mon Nov 30 20:35:37 2009
@@ -0,0 +1,217 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast
+// RUN: c-index-test -test-load-tu %t.ast scan-function | FileCheck %s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ at interface Foo
+{
+}
+
+- foo;
++ fooC;
+
+ at end
+
+ at interface Bar : Foo
+{
+}
+
+ at end
+
+ at interface Foo (FooCat)
+- (int) catMethodWithFloat:(float) fArg;
+- (float) floatMethod;
+ at end
+
+ at protocol Proto
+- pMethod;
+ at end
+
+ at protocol SubP <Proto>
+- spMethod;
+ at end
+
+ at interface Baz : Bar <SubP>
+{
+ int _anIVar;
+}
+
+- (Foo *) bazMethod;
+
+ at end
+
+enum {
+ someEnum
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+int main (int argc, const char * argv[]) {
+ Baz * bee;
+ id a = [bee foo];
+ id <SubP> c = [Foo fooC];
+ id <Proto> d;
+ d = c;
+ [d pMethod];
+ [bee catMethodWithFloat:[bee floatMethod]];
+ main(someEnum, (const char **)bee);
+}
+
+// CHECK: c-index-api-fn-scan.m:84:2: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-fn-scan.m:84:3: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-fn-scan.m:84:4: ObjCClassRef=Baz:84:8 [Context:Baz]
+// CHECK: c-index-api-fn-scan.m:84:6: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-fn-scan.m:84:8: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-fn-scan.m:84:9: VarDecl=bee:84:8 [Context:bee]
+// CHECK: c-index-api-fn-scan.m:84:10: VarDecl=bee:84:8 [Context:bee]
+// CHECK: <invalid loc>:85:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:85:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-fn-scan.m:85:5: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:6: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:7: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:8: VarDecl=a:85:5 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:9: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:10: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:11: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:12: VarRef=bee:84:8 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:13: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:14: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:15: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:16: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: c-index-api-fn-scan.m:85:17: ObjCSelectorRef=foo:24:1 [Context:a]
+// CHECK: <invalid loc>:86:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:86:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-fn-scan.m:86:5: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:6: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-fn-scan.m:86:7: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-fn-scan.m:86:8: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-fn-scan.m:86:9: ObjCProtocolRef=SubP:86:12 [Context:SubP]
+// CHECK: c-index-api-fn-scan.m:86:10: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:12: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:13: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:14: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:15: VarDecl=c:86:12 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:16: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:17: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:18: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:19: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:20: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:21: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:22: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:23: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:24: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: c-index-api-fn-scan.m:86:25: ObjCSelectorRef=fooC:25:1 [Context:c]
+// CHECK: <invalid loc>:87:2: TypedefDecl=id:0:0 [Context:id]
+// CHECK: <invalid loc>:87:3: TypedefDecl=id:0:0 [Context:id]
+// CHECK: c-index-api-fn-scan.m:87:5: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-fn-scan.m:87:6: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-fn-scan.m:87:7: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-fn-scan.m:87:8: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-fn-scan.m:87:9: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-fn-scan.m:87:10: ObjCProtocolRef=Proto:87:13 [Context:Proto]
+// CHECK: c-index-api-fn-scan.m:87:11: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-fn-scan.m:87:13: VarDecl=d:87:13 [Context:d]
+// CHECK: c-index-api-fn-scan.m:88:2: VarRef=d:87:13 [Context:main]
+// CHECK: c-index-api-fn-scan.m:88:6: VarRef=c:86:12 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:2: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:3: VarRef=d:87:13 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:4: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:5: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:6: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:7: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:8: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:9: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:10: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:11: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:89:12: ObjCSelectorRef=pMethod:41:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:2: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:3: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:4: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:5: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:6: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:7: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:8: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:9: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:10: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:11: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:12: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:13: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:14: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:15: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:16: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:17: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:18: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:19: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:20: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:21: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:22: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:23: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:24: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:25: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:26: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:27: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:28: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:29: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:30: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:31: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:32: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:33: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:34: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:35: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:36: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:37: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:38: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:39: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:40: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:41: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:42: ObjCSelectorRef=floatMethod:37:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:90:43: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:3: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:4: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:5: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:6: FunctionRef=main:83:5 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:8: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:9: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:10: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:11: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:12: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:13: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:14: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:15: EnumConstantRef=someEnum:58:3 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:33: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:34: VarRef=bee:84:8 [Context:main]
+// CHECK: c-index-api-fn-scan.m:91:35: VarRef=bee:84:8 [Context:main]
Modified: cfe/trunk/test/Index/c-index-api-loadTU-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-api-loadTU-test.m?rev=90193&r1=90192&r2=90193&view=diff
==============================================================================
--- cfe/trunk/test/Index/c-index-api-loadTU-test.m (original)
+++ cfe/trunk/test/Index/c-index-api-loadTU-test.m Mon Nov 30 20:35:37 2009
@@ -98,127 +98,3 @@
// CHECK: c-index-api-loadTU-test.m:85:5: VarDecl=a:85:5 [Context=main]
// CHECK: c-index-api-loadTU-test.m:86:12: VarDecl=c:86:12 [Context=main]
// CHECK: c-index-api-loadTU-test.m:87:13: VarDecl=d:87:13 [Context=main]
-// CHECK: c-index-api-loadTU-test.m:84:2: ObjCClassRef=Baz:84:8 [Context:Baz]
-// CHECK: c-index-api-loadTU-test.m:84:3: ObjCClassRef=Baz:84:8 [Context:Baz]
-// CHECK: c-index-api-loadTU-test.m:84:4: ObjCClassRef=Baz:84:8 [Context:Baz]
-// CHECK: c-index-api-loadTU-test.m:84:6: VarDecl=bee:84:8 [Context:bee]
-// CHECK: c-index-api-loadTU-test.m:84:8: VarDecl=bee:84:8 [Context:bee]
-// CHECK: c-index-api-loadTU-test.m:84:9: VarDecl=bee:84:8 [Context:bee]
-// CHECK: c-index-api-loadTU-test.m:84:10: VarDecl=bee:84:8 [Context:bee]
-// CHECK: <invalid loc>:85:2: TypedefDecl=id:0:0 [Context:id]
-// CHECK: <invalid loc>:85:3: TypedefDecl=id:0:0 [Context:id]
-// CHECK: c-index-api-loadTU-test.m:85:5: VarDecl=a:85:5 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:6: VarDecl=a:85:5 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:7: VarDecl=a:85:5 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:8: VarDecl=a:85:5 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:9: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:10: VarRef=bee:84:8 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:11: VarRef=bee:84:8 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:12: VarRef=bee:84:8 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:13: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:14: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:15: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:16: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: c-index-api-loadTU-test.m:85:17: ObjCSelectorRef=foo:24:1 [Context:a]
-// CHECK: <invalid loc>:86:2: TypedefDecl=id:0:0 [Context:id]
-// CHECK: <invalid loc>:86:3: TypedefDecl=id:0:0 [Context:id]
-// CHECK: c-index-api-loadTU-test.m:86:5: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:6: ObjCProtocolRef=SubP:86:12 [Context:SubP]
-// CHECK: c-index-api-loadTU-test.m:86:7: ObjCProtocolRef=SubP:86:12 [Context:SubP]
-// CHECK: c-index-api-loadTU-test.m:86:8: ObjCProtocolRef=SubP:86:12 [Context:SubP]
-// CHECK: c-index-api-loadTU-test.m:86:9: ObjCProtocolRef=SubP:86:12 [Context:SubP]
-// CHECK: c-index-api-loadTU-test.m:86:10: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:12: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:13: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:14: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:15: VarDecl=c:86:12 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:16: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:17: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:18: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:19: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:20: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:21: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:22: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:23: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:24: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: c-index-api-loadTU-test.m:86:25: ObjCSelectorRef=fooC:25:1 [Context:c]
-// CHECK: <invalid loc>:87:2: TypedefDecl=id:0:0 [Context:id]
-// CHECK: <invalid loc>:87:3: TypedefDecl=id:0:0 [Context:id]
-// CHECK: c-index-api-loadTU-test.m:87:5: VarDecl=d:87:13 [Context:d]
-// CHECK: c-index-api-loadTU-test.m:87:6: ObjCProtocolRef=Proto:87:13 [Context:Proto]
-// CHECK: c-index-api-loadTU-test.m:87:7: ObjCProtocolRef=Proto:87:13 [Context:Proto]
-// CHECK: c-index-api-loadTU-test.m:87:8: ObjCProtocolRef=Proto:87:13 [Context:Proto]
-// CHECK: c-index-api-loadTU-test.m:87:9: ObjCProtocolRef=Proto:87:13 [Context:Proto]
-// CHECK: c-index-api-loadTU-test.m:87:10: ObjCProtocolRef=Proto:87:13 [Context:Proto]
-// CHECK: c-index-api-loadTU-test.m:87:11: VarDecl=d:87:13 [Context:d]
-// CHECK: c-index-api-loadTU-test.m:87:13: VarDecl=d:87:13 [Context:d]
-// CHECK: c-index-api-loadTU-test.m:88:2: VarRef=d:87:13 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:88:6: VarRef=c:86:12 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:2: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:3: VarRef=d:87:13 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:4: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:5: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:6: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:7: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:8: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:9: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:10: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:11: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:89:12: ObjCSelectorRef=pMethod:41:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:2: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:3: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:4: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:5: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:6: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:7: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:8: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:9: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:10: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:11: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:12: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:13: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:14: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:15: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:16: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:17: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:18: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:19: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:20: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:21: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:22: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:23: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:24: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:25: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:26: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:27: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:28: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:29: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:30: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:31: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:32: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:33: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:34: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:35: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:36: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:37: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:38: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:39: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:40: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:41: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:42: ObjCSelectorRef=floatMethod:37:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:90:43: ObjCSelectorRef=catMethodWithFloat::36:1 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:3: FunctionRef=main:83:5 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:4: FunctionRef=main:83:5 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:5: FunctionRef=main:83:5 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:6: FunctionRef=main:83:5 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:8: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:9: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:10: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:11: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:12: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:13: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:14: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:15: EnumConstantRef=someEnum:58:3 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:33: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:34: VarRef=bee:84:8 [Context:main]
-// CHECK: c-index-api-loadTU-test.m:91:35: VarRef=bee:84:8 [Context:main]
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=90193&r1=90192&r2=90193&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 30 20:35:37 2009
@@ -38,7 +38,6 @@
return 1;
}
-
/******************************************************************************/
/* Pretty-printing. */
/******************************************************************************/
@@ -71,8 +70,7 @@
/* Logic for testing clang_loadTranslationUnit(). */
/******************************************************************************/
-static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter)
-{
+static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter) {
if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
CXString string;
printf("// CHECK: %s:%d:%d: ", GetCursorSource(Cursor),
@@ -84,9 +82,9 @@
clang_disposeString(string);
}
}
+
static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor,
- CXClientData Filter)
-{
+ CXClientData Filter) {
if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
CXString string;
printf("// CHECK: %s:%d:%d: ", GetCursorSource(Cursor),
@@ -99,58 +97,56 @@
clang_disposeString(string);
clang_loadDeclaration(Cursor.decl, DeclVisitor, 0);
+ }
+}
- if (Cursor.kind == CXCursor_FunctionDefn) {
- const char *startBuf, *endBuf;
- unsigned startLine, startColumn, endLine, endColumn;
- clang_getDefinitionSpellingAndExtent(Cursor, &startBuf, &endBuf,
- &startLine, &startColumn,
- &endLine, &endColumn);
- {
- /* Probe the entire body, looking for both decls and refs. */
- unsigned curLine = startLine, curColumn = startColumn;
- CXCursor Ref;
-
- while (startBuf < endBuf) {
- if (*startBuf == '\n') {
- startBuf++;
- curLine++;
- curColumn = 1;
- } else if (*startBuf != '\t')
- curColumn++;
+static void FunctionScanVisitor(CXTranslationUnit Unit, CXCursor Cursor,
+ CXClientData Filter) {
+ const char *startBuf, *endBuf;
+ unsigned startLine, startColumn, endLine, endColumn, curLine, curColumn;
+ CXCursor Ref;
+
+ if (Cursor.kind != CXCursor_FunctionDefn)
+ return;
+
+ clang_getDefinitionSpellingAndExtent(Cursor, &startBuf, &endBuf,
+ &startLine, &startColumn,
+ &endLine, &endColumn);
+ /* Probe the entire body, looking for both decls and refs. */
+ curLine = startLine;
+ curColumn = startColumn;
+
+ while (startBuf < endBuf) {
+ if (*startBuf == '\n') {
+ startBuf++;
+ curLine++;
+ curColumn = 1;
+ } else if (*startBuf != '\t')
+ curColumn++;
- Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor),
- curLine, curColumn);
- if (Ref.kind == CXCursor_NoDeclFound) {
- /* Nothing found here; that's fine. */
- } else if (Ref.kind != CXCursor_FunctionDecl) {
- CXString string;
- printf("// CHECK: %s:%d:%d: ", GetCursorSource(Ref),
- curLine, curColumn);
- PrintCursor(Ref);
- string = clang_getDeclSpelling(Ref.decl);
- printf(" [Context:%s]\n", clang_getCString(string));
- clang_disposeString(string);
- }
- startBuf++;
- }
- }
+ Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor),
+ curLine, curColumn);
+ if (Ref.kind == CXCursor_NoDeclFound) {
+ /* Nothing found here; that's fine. */
+ } else if (Ref.kind != CXCursor_FunctionDecl) {
+ CXString string;
+ printf("// CHECK: %s:%d:%d: ", GetCursorSource(Ref),
+ curLine, curColumn);
+ PrintCursor(Ref);
+ string = clang_getDeclSpelling(Ref.decl);
+ printf(" [Context:%s]\n", clang_getCString(string));
+ clang_disposeString(string);
}
+ startBuf++;
}
}
-int perform_test_load_tu(const char *file, const char *filter) {
- CXIndex Idx;
- CXTranslationUnit TU;
+static int perform_test_load(CXIndex Idx, CXTranslationUnit TU,
+ const char *filter) {
enum CXCursorKind K = CXCursor_NotImplemented;
+ CXTranslationUnitIterator Visitor = TranslationUnitVisitor;
enum CXCursorKind *ck = &K;
- Idx = clang_createIndex(/* excludeDeclsFromPCH */
- !strcmp(filter, "local") ? 1 : 0,
- /* displayDiagnostics */ 1);
-
- if (!CreateTranslationUnit(Idx, file, &TU))
- return 1;
-
+
/* Perform some simple filtering. */
if (!strcmp(filter, "all") || !strcmp(filter, "local")) ck = NULL;
else if (!strcmp(filter, "category")) K = CXCursor_ObjCCategoryDecl;
@@ -158,21 +154,33 @@
else if (!strcmp(filter, "protocol")) K = CXCursor_ObjCProtocolDecl;
else if (!strcmp(filter, "function")) K = CXCursor_FunctionDecl;
else if (!strcmp(filter, "typedef")) K = CXCursor_TypedefDecl;
+ else if (!strcmp(filter, "scan-function")) Visitor = FunctionScanVisitor;
else {
fprintf(stderr, "Unknown filter for -test-load-tu: %s\n", filter);
return 1;
}
- clang_loadTranslationUnit(TU, TranslationUnitVisitor, ck);
+ clang_loadTranslationUnit(TU, Visitor, ck);
clang_disposeTranslationUnit(TU);
return 0;
}
+int perform_test_load_tu(const char *file, const char *filter) {
+ CXIndex Idx;
+ CXTranslationUnit TU;
+ Idx = clang_createIndex(/* excludeDeclsFromPCH */
+ !strcmp(filter, "local") ? 1 : 0,
+ /* displayDiagnostics */ 1);
+
+ if (!CreateTranslationUnit(Idx, file, &TU))
+ return 1;
+
+ return perform_test_load(Idx, TU, filter);
+}
+
int perform_test_load_source(int argc, const char **argv, const char *filter) {
CXIndex Idx;
CXTranslationUnit TU;
- enum CXCursorKind K = CXCursor_NotImplemented;
- enum CXCursorKind *ck = &K;
Idx = clang_createIndex(/* excludeDeclsFromPCH */
!strcmp(filter, "local") ? 1 : 0,
/* displayDiagnostics */ 1);
@@ -183,21 +191,7 @@
return 1;
}
- /* Perform some simple filtering. */
- if (!strcmp(filter, "all") || !strcmp(filter, "local")) ck = NULL;
- else if (!strcmp(filter, "category")) K = CXCursor_ObjCCategoryDecl;
- else if (!strcmp(filter, "interface")) K = CXCursor_ObjCInterfaceDecl;
- else if (!strcmp(filter, "protocol")) K = CXCursor_ObjCProtocolDecl;
- else if (!strcmp(filter, "function")) K = CXCursor_FunctionDecl;
- else if (!strcmp(filter, "typedef")) K = CXCursor_TypedefDecl;
- else {
- fprintf(stderr, "Unknown filter for -test-load-tu: %s\n", filter);
- return 1;
- }
-
- clang_loadTranslationUnit(TU, TranslationUnitVisitor, ck);
- clang_disposeTranslationUnit(TU);
- return 0;
+ return perform_test_load(Idx, TU, filter);
}
/******************************************************************************/
@@ -434,7 +428,8 @@
" interface - only load ObjC interfaces (non-PCH)\n"
" protocol - only load ObjC protocols (non-PCH)\n"
" function - only load functions (non-PCH)\n"
- " typedef - only load typdefs (non-PCH)\n\n");
+ " typedef - only load typdefs (non-PCH)\n"
+ " scan-function - scan function bodies (non-PCH)\n\n");
}
int main(int argc, const char **argv) {
More information about the cfe-commits
mailing list