Ted Kremenek | 1c6da17 | 2009-11-17 19:37:36 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast |
| 2 | // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck %s |
| 3 | @interface Foo |
| 4 | { |
| 5 | } |
| 6 | |
| 7 | - foo; |
| 8 | + fooC; |
| 9 | |
| 10 | @end |
| 11 | |
| 12 | @interface Bar : Foo |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | @end |
| 17 | |
| 18 | @interface Foo (FooCat) |
| 19 | - (int) catMethodWithFloat:(float) fArg; |
| 20 | - (float) floatMethod; |
| 21 | @end |
| 22 | |
| 23 | @protocol Proto |
| 24 | - pMethod; |
| 25 | @end |
| 26 | |
| 27 | @protocol SubP <Proto> |
| 28 | - spMethod; |
| 29 | @end |
| 30 | |
| 31 | @interface Baz : Bar <SubP> |
| 32 | { |
| 33 | int _anIVar; |
| 34 | } |
| 35 | |
| 36 | - (Foo *) bazMethod; |
| 37 | |
| 38 | @end |
| 39 | |
| 40 | enum { |
| 41 | someEnum |
| 42 | }; |
| 43 | |
| 44 | int main (int argc, const char * argv[]) { |
| 45 | Baz * bee; |
| 46 | id a = [bee foo]; |
| 47 | id <SubP> c = [Foo fooC]; |
| 48 | id <Proto> d; |
| 49 | d = c; |
| 50 | [d pMethod]; |
| 51 | [bee catMethodWithFloat:[bee floatMethod]]; |
| 52 | main(someEnum, (const char **)bee); |
| 53 | } |
| 54 | |
| 55 | // CHECK: {start_line=1 start_col=1 end_line=2 end_col=62} Invalid Cursor => NoDeclFound |
| 56 | // CHECK: {start_line=3 start_col=1 end_line=6 end_col=1} ObjCInterfaceDecl=Foo:3:1 |
| 57 | // CHECK: {start_line=7 start_col=1 end_line=7 end_col=6} ObjCInstanceMethodDecl=foo:7:1 |
| 58 | // CHECK: {start_line=7 start_col=7 end_line=7 end_col=7} ObjCInterfaceDecl=Foo:3:1 |
| 59 | // CHECK: {start_line=8 start_col=1 end_line=8 end_col=7} ObjCClassMethodDecl=fooC:8:1 |
| 60 | // CHECK: {start_line=8 start_col=8 end_line=10 end_col=1} ObjCInterfaceDecl=Foo:3:1 |
| 61 | // CHECK: {start_line=10 start_col=2 end_line=11 end_col=1} Invalid Cursor => NoDeclFound |
| 62 | // CHECK: {start_line=12 start_col=1 end_line=16 end_col=1} ObjCInterfaceDecl=Bar:12:1 |
| 63 | // CHECK: {start_line=16 start_col=2 end_line=17 end_col=1} Invalid Cursor => NoDeclFound |
| 64 | // CHECK: {start_line=18 start_col=1 end_line=18 end_col=24} ObjCCategoryDecl=FooCat:18:1 |
| 65 | // CHECK: {start_line=19 start_col=1 end_line=19 end_col=28} ObjCInstanceMethodDecl=catMethodWithFloat::19:1 |
| 66 | // CHECK: {start_line=19 start_col=29 end_line=19 end_col=33} ParmDecl=fArg:19:36 |
| 67 | // CHECK: {start_line=19 start_col=34 end_line=19 end_col=35} ObjCInstanceMethodDecl=catMethodWithFloat::19:1 |
| 68 | // CHECK: {start_line=19 start_col=36 end_line=19 end_col=39} ParmDecl=fArg:19:36 |
| 69 | // CHECK: {start_line=19 start_col=40 end_line=19 end_col=40} ObjCInstanceMethodDecl=catMethodWithFloat::19:1 |
| 70 | // CHECK: {start_line=19 start_col=41 end_line=19 end_col=41} ObjCCategoryDecl=FooCat:18:1 |
| 71 | // CHECK: {start_line=20 start_col=1 end_line=20 end_col=22} ObjCInstanceMethodDecl=floatMethod:20:1 |
| 72 | // CHECK: {start_line=20 start_col=23 end_line=21 end_col=1} ObjCCategoryDecl=FooCat:18:1 |
| 73 | // CHECK: {start_line=21 start_col=2 end_line=22 end_col=1} Invalid Cursor => NoDeclFound |
| 74 | // CHECK: {start_line=23 start_col=1 end_line=23 end_col=16} ObjCProtocolDecl=Proto:23:1 |
| 75 | // CHECK: {start_line=24 start_col=1 end_line=24 end_col=10} ObjCInstanceMethodDecl=pMethod:24:1 |
| 76 | // CHECK: {start_line=24 start_col=11 end_line=25 end_col=1} ObjCProtocolDecl=Proto:23:1 |
| 77 | // CHECK: {start_line=25 start_col=2 end_line=26 end_col=1} Invalid Cursor => NoDeclFound |
| 78 | // CHECK: {start_line=27 start_col=1 end_line=27 end_col=23} ObjCProtocolDecl=SubP:27:1 |
| 79 | // CHECK: {start_line=28 start_col=1 end_line=28 end_col=11} ObjCInstanceMethodDecl=spMethod:28:1 |
| 80 | // CHECK: {start_line=28 start_col=12 end_line=29 end_col=1} ObjCProtocolDecl=SubP:27:1 |
| 81 | // CHECK: {start_line=29 start_col=2 end_line=30 end_col=1} Invalid Cursor => NoDeclFound |
| 82 | // CHECK: {start_line=31 start_col=1 end_line=33 end_col=4} ObjCInterfaceDecl=Baz:31:1 |
| 83 | // CHECK: {start_line=33 start_col=5 end_line=33 end_col=7} Invalid Cursor => NotImplemented |
| 84 | // CHECK: {start_line=33 start_col=8 end_line=33 end_col=8} ObjCInterfaceDecl=Baz:31:1 |
| 85 | // CHECK: {start_line=33 start_col=9 end_line=33 end_col=15} Invalid Cursor => NotImplemented |
| 86 | // CHECK: {start_line=33 start_col=16 end_line=35 end_col=1} ObjCInterfaceDecl=Baz:31:1 |
| 87 | // CHECK: {start_line=36 start_col=1 end_line=36 end_col=20} ObjCInstanceMethodDecl=bazMethod:36:1 |
| 88 | // CHECK: {start_line=36 start_col=21 end_line=38 end_col=1} ObjCInterfaceDecl=Baz:31:1 |
| 89 | // CHECK: {start_line=38 start_col=2 end_line=39 end_col=1} Invalid Cursor => NoDeclFound |
| 90 | // CHECK: {start_line=40 start_col=1 end_line=41 end_col=2} EnumDecl=:40:1 |
| 91 | // CHECK: {start_line=41 start_col=3 end_line=41 end_col=10} EnumConstantDecl=someEnum:41:3 |
| 92 | // CHECK: {start_line=41 start_col=11 end_line=42 end_col=1} EnumDecl=:40:1 |
| 93 | // CHECK: {start_line=42 start_col=2 end_line=43 end_col=1} Invalid Cursor => NoDeclFound |
| 94 | // CHECK: {start_line=44 start_col=1 end_line=44 end_col=3} FunctionDecl=main:44:5 |
| 95 | // CHECK: {start_line=44 start_col=4 end_line=44 end_col=4} Invalid Cursor => NoDeclFound |
| 96 | // CHECK: {start_line=44 start_col=5 end_line=44 end_col=10} FunctionDecl=main:44:5 |
| 97 | // CHECK: {start_line=44 start_col=11 end_line=44 end_col=13} ParmDecl=argc:44:15 |
| 98 | // CHECK: {start_line=44 start_col=14 end_line=44 end_col=14} FunctionDecl=main:44:5 |
| 99 | // CHECK: {start_line=44 start_col=15 end_line=44 end_col=18} ParmDecl=argc:44:15 |
| 100 | // CHECK: {start_line=44 start_col=19 end_line=44 end_col=26} FunctionDecl=main:44:5 |
| 101 | // CHECK: {start_line=44 start_col=27 end_line=44 end_col=30} ParmDecl=argv:44:34 |
| 102 | // CHECK: {start_line=44 start_col=31 end_line=44 end_col=31} FunctionDecl=main:44:5 |
| 103 | // CHECK: {start_line=44 start_col=32 end_line=44 end_col=32} ParmDecl=argv:44:34 |
| 104 | // CHECK: {start_line=44 start_col=33 end_line=44 end_col=33} FunctionDecl=main:44:5 |
| 105 | // CHECK: {start_line=44 start_col=34 end_line=44 end_col=39} ParmDecl=argv:44:34 |
| 106 | // CHECK: {start_line=44 start_col=40 end_line=45 end_col=1} FunctionDecl=main:44:5 |
| 107 | // CHECK: {start_line=45 start_col=2 end_line=45 end_col=4} ObjCClassRef=Baz:45:8 |
| 108 | // CHECK: {start_line=45 start_col=5 end_line=45 end_col=5} FunctionDecl=main:44:5 |
| 109 | // CHECK: {start_line=45 start_col=6 end_line=45 end_col=6} VarDecl=bee:45:8 |
| 110 | // CHECK: {start_line=45 start_col=7 end_line=45 end_col=7} FunctionDecl=main:44:5 |
| 111 | // CHECK: {start_line=45 start_col=8 end_line=45 end_col=10} VarDecl=bee:45:8 |
| 112 | // CHECK: {start_line=45 start_col=11 end_line=46 end_col=1} FunctionDecl=main:44:5 |
| 113 | // CHECK: {start_line=46 start_col=2 end_line=46 end_col=3} TypedefDecl=id:0:0 |
| 114 | // CHECK: {start_line=46 start_col=4 end_line=46 end_col=4} FunctionDecl=main:44:5 |
| 115 | // CHECK: {start_line=46 start_col=5 end_line=46 end_col=8} VarDecl=a:46:5 |
| 116 | // CHECK: {start_line=46 start_col=9 end_line=46 end_col=9} ObjCSelectorRef=foo:7:1 |
| 117 | // CHECK: {start_line=46 start_col=10 end_line=46 end_col=12} VarRef=bee:45:8 |
| 118 | // CHECK: {start_line=46 start_col=13 end_line=46 end_col=17} ObjCSelectorRef=foo:7:1 |
| 119 | // CHECK: {start_line=46 start_col=18 end_line=47 end_col=1} FunctionDecl=main:44:5 |
| 120 | // CHECK: {start_line=47 start_col=2 end_line=47 end_col=3} TypedefDecl=id:0:0 |
| 121 | // CHECK: {start_line=47 start_col=4 end_line=47 end_col=4} FunctionDecl=main:44:5 |
| 122 | // CHECK: {start_line=47 start_col=5 end_line=47 end_col=5} VarDecl=c:47:12 |
| 123 | // CHECK: {start_line=47 start_col=6 end_line=47 end_col=9} ObjCProtocolRef=SubP:47:12 |
| 124 | // CHECK: {start_line=47 start_col=10 end_line=47 end_col=10} VarDecl=c:47:12 |
| 125 | // CHECK: {start_line=47 start_col=11 end_line=47 end_col=11} FunctionDecl=main:44:5 |
| 126 | // CHECK: {start_line=47 start_col=12 end_line=47 end_col=15} VarDecl=c:47:12 |
| 127 | // CHECK: {start_line=47 start_col=16 end_line=47 end_col=25} ObjCSelectorRef=fooC:8:1 |
| 128 | // CHECK: {start_line=47 start_col=26 end_line=48 end_col=1} FunctionDecl=main:44:5 |
| 129 | // CHECK: {start_line=48 start_col=2 end_line=48 end_col=3} TypedefDecl=id:0:0 |
| 130 | // CHECK: {start_line=48 start_col=4 end_line=48 end_col=4} FunctionDecl=main:44:5 |
| 131 | // CHECK: {start_line=48 start_col=5 end_line=48 end_col=5} VarDecl=d:48:13 |
| 132 | // CHECK: {start_line=48 start_col=6 end_line=48 end_col=10} ObjCProtocolRef=Proto:48:13 |
| 133 | // CHECK: {start_line=48 start_col=11 end_line=48 end_col=11} VarDecl=d:48:13 |
| 134 | // CHECK: {start_line=48 start_col=12 end_line=48 end_col=12} FunctionDecl=main:44:5 |
| 135 | // CHECK: {start_line=48 start_col=13 end_line=48 end_col=13} VarDecl=d:48:13 |
| 136 | // CHECK: {start_line=48 start_col=14 end_line=49 end_col=1} FunctionDecl=main:44:5 |
| 137 | // CHECK: {start_line=49 start_col=2 end_line=49 end_col=2} VarRef=d:48:13 |
| 138 | // CHECK: {start_line=49 start_col=3 end_line=49 end_col=5} FunctionDecl=main:44:5 |
| 139 | // CHECK: {start_line=49 start_col=6 end_line=49 end_col=6} VarRef=c:47:12 |
| 140 | // CHECK: {start_line=49 start_col=7 end_line=50 end_col=1} FunctionDecl=main:44:5 |
| 141 | // CHECK: {start_line=50 start_col=2 end_line=50 end_col=2} ObjCSelectorRef=pMethod:24:1 |
| 142 | // CHECK: {start_line=50 start_col=3 end_line=50 end_col=3} VarRef=d:48:13 |
| 143 | // CHECK: {start_line=50 start_col=4 end_line=50 end_col=12} ObjCSelectorRef=pMethod:24:1 |
| 144 | // CHECK: {start_line=50 start_col=13 end_line=51 end_col=1} FunctionDecl=main:44:5 |
| 145 | // CHECK: {start_line=51 start_col=2 end_line=51 end_col=2} ObjCSelectorRef=catMethodWithFloat::19:1 |
| 146 | // CHECK: {start_line=51 start_col=3 end_line=51 end_col=5} VarRef=bee:45:8 |
| 147 | // CHECK: {start_line=51 start_col=6 end_line=51 end_col=25} ObjCSelectorRef=catMethodWithFloat::19:1 |
| 148 | // CHECK: {start_line=51 start_col=26 end_line=51 end_col=26} ObjCSelectorRef=floatMethod:20:1 |
| 149 | // CHECK: {start_line=51 start_col=27 end_line=51 end_col=29} VarRef=bee:45:8 |
| 150 | // CHECK: {start_line=51 start_col=30 end_line=51 end_col=42} ObjCSelectorRef=floatMethod:20:1 |
| 151 | // CHECK: {start_line=51 start_col=43 end_line=51 end_col=43} ObjCSelectorRef=catMethodWithFloat::19:1 |
| 152 | // CHECK: {start_line=51 start_col=44 end_line=52 end_col=2} FunctionDecl=main:44:5 |
| 153 | // CHECK: {start_line=52 start_col=3 end_line=52 end_col=6} FunctionRef=main:44:5 |
| 154 | // CHECK: {start_line=52 start_col=7 end_line=52 end_col=7} FunctionDecl=main:44:5 |
| 155 | // CHECK: {start_line=52 start_col=8 end_line=52 end_col=15} EnumConstantRef=someEnum:41:3 |
| 156 | // CHECK: {start_line=52 start_col=16 end_line=52 end_col=32} FunctionDecl=main:44:5 |
| 157 | // CHECK: {start_line=52 start_col=33 end_line=52 end_col=35} VarRef=bee:45:8 |
| 158 | // CHECK: {start_line=52 start_col=36 end_line=53 end_col=1} FunctionDecl=main:44:5 |
| 159 | // CHECK: {start_line=53 start_col=2 end_line=160 end_col=1} Invalid Cursor => NoDeclFound |
| 160 | |