[cfe-commits] r41964 - in /cfe/trunk: Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/AST/Decl.h

Chris Lattner clattner at apple.com
Fri Sep 14 18:32:05 PDT 2007


>> ===================================================================== 
>> =
>> ========
>> --- cfe/trunk/include/clang/AST/Decl.h (original)
>> +++ cfe/trunk/include/clang/AST/Decl.h Fri Sep 14 17:20:54 2007
>> @@ -342,7 +342,7 @@
>>
>>    // Implement isa/cast/dyncast/etc.
>>    static bool classof(const Decl *D) {
>> -    return D->getKind() == Field;
>> +    return D->getKind() == Field || D->getKind() == ObjcIvar;
>
> This looks odd to me? What are you accomplishing by saying a
> FieldDecl object is both?

'classof' is a funny method, which has an inverted meaning from what  
you might expect.  This is saying that any Decl with a kind of  
"Field" or "ObjcIvar" is an instance or subclass of FieldDecl.   
Because ObjcIvar is a subclass of FieldDecl, this method should  
return true for it so that:

cast<FieldDecl>(some_objcivar)

succeeds.

-Chris



More information about the cfe-commits mailing list