ObjC token annotations
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Apr 4 11:49:59 PDT 2013
We should mark it as CXToken_Keyword, as we do with other context-sensitive keywords (see at end of clang_annotateTokensImpl); please file a bug report.
On Apr 3, 2013, at 9:09 AM, Jordan Rose <jordan_rose at apple.com> wrote:
> I don't happen to know specifically, but I will note that "super" is not an expression; it's a context-sensitive keyword. ("self", on the other hand, is an implicit parameter with a fixed name.) As such, there's no useful Expr that can be attached to it. I would guess libclang picks the ObjCMessageExpr as the "best" context and leaves it at that.
>
> Jordan
>
>
> On Apr 2, 2013, at 12:44 , Erik Verbruggen <erikjv at me.com> wrote:
>
>> Another token annotation question, this time about ObjC's self/super.
>>
>> I have this snippet:
>>
>> SubIFace *inst;
>> [inst a];
>> [self a];
>> [super a];
>>
>> When running that through c-index-test -test-annotate-tokens, I get some results I don't completely understand:
>>
>> Identifier: "SubIFace" [153:14 - 153:22] ObjCClassRef=SubIFace:148:12
>> Punctuation: "*" [153:23 - 153:24] VarDecl=inst:153:24 (Definition)
>> Identifier: "inst" [153:24 - 153:28] VarDecl=inst:153:24 (Definition)
>> Punctuation: ";" [153:28 - 153:29] DeclStmt=
>> Punctuation: "[" [154:5 - 154:6] ObjCMessageExpr=a:146:10
>> Identifier: "inst" [154:6 - 154:10] DeclRefExpr=inst:153:24
>> Identifier: "a" [154:11 - 154:12] ObjCMessageExpr=a:146:10
>> Punctuation: "]" [154:12 - 154:13] ObjCMessageExpr=a:146:10
>> Punctuation: ";" [154:13 - 154:14] CompoundStmt=
>> Punctuation: "[" [155:5 - 155:6] ObjCMessageExpr=a:146:10
>> Identifier: "self" [155:6 - 155:10] DeclRefExpr=self:0:0
>> Identifier: "a" [155:11 - 155:12] ObjCMessageExpr=a:146:10
>> Punctuation: "]" [155:12 - 155:13] ObjCMessageExpr=a:146:10
>> Punctuation: ";" [155:13 - 155:14] CompoundStmt=
>> Punctuation: "[" [156:5 - 156:6] ObjCMessageExpr=a:146:10
>> Identifier: "super" [156:6 - 156:11] ObjCMessageExpr=a:146:10
>> Identifier: "a" [156:12 - 156:13] ObjCMessageExpr=a:146:10
>> Punctuation: "]" [156:13 - 156:14] ObjCMessageExpr=a:146:10
>> Punctuation: ";" [156:14 - 156:15] CompoundStmt=
>>
>> So, "inst" in the first expression is a DeclRefExpr, just like "self" in the second one. However, "super" in the last expression is annotated with "ObjCMessageExpr=a"... Is that on purpose, and if so, what is the reasoning behind it?
>>
>> Regards,
>> Erik.
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130404/4d98d847/attachment.html>
More information about the cfe-commits
mailing list