[cfe-dev] Bug in 'super' parsing (Re: Objective-C tidy up)
David Chisnall
theraven at sucs.org
Thu Jun 5 09:09:24 PDT 2008
On 5 Jun 2008, at 16:26, David Chisnall wrote:
> On 4 Jun 2008, at 18:11, Chris Lattner wrote:
>
>>> Any function in Objective-C can use self and _cmd as identifier
>>> names. Any occurrence of the 'this' token in a C++ program refers
>>> to an instance of an object with a type defined by the context.
>>
>> Does 'super' in ObjC work the same way?
>
> Yes. Objective-C is a pure superset of C, so anything that is valid C
> is valid Objective-C. Which means my current handling of super is
> wrong...
In fact, handling of super is wrong, but only slightly. I am testing
if the identifier is "super" in only if CurMethodDecl is set, so the
predefined expr is only create inside an objective-c method. There is
a bug, however. I am testing for the identifier using strncmp, which
means that super_class and other identifiers of this form will be
treated as being 'super,' which is clearly wrong.
Can someone please change:
if (SD == 0 && !strncmp(II.getName(), "super", 5)) {
to
if (SD == 0 && !strcmp(II.getName(), "super")) {
On lib/Sema/SemaExpr.cpp:102.
David
More information about the cfe-dev
mailing list