[cfe-commits] r146669 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Serialization/ASTReaderDecl.cpp

Douglas Gregor dgregor at apple.com
Thu Dec 15 10:33:52 PST 2011


On Dec 15, 2011, at 10:32 AM, jahanian wrote:

> 
> On Dec 15, 2011, at 10:17 AM, Douglas Gregor wrote:
> 
>> Author: dgregor
>> Date: Thu Dec 15 12:17:27 2011
>> New Revision: 146669
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=146669&view=rev
>> Log:
>> Extend ObjCInterfaceDecl::DefinitionData to contain a pointer to the
>> definition, and implement ObjCInterfaceDecl::getDefinition()
>> efficiently based on that.
>> 
>> Modified:
>>   cfe/trunk/include/clang/AST/DeclObjC.h
>>   cfe/trunk/lib/AST/DeclObjC.cpp
>>   cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> 
>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=146669&r1=146668&r2=146669&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Dec 15 12:17:27 2011
>> 
>> +  /// \brief Determine whether this class has only ever been forward-declared.
>> +  bool isForwardDecl() const { return Data == 0; }
>> +                          
>>  /// \brief Determine whether this particular declaration of this class is
>>  /// actually also a definition.
>> -  bool isThisDeclarationADefinition() const { return Definition.getInt(); }
>> +  bool isThisDeclarationADefinition() const { 
>> +    return Data == 0 || Data->Definition != this;
>> +  }
> 
> "Data == 0" means that forward decl. is the only definition. Can you add comment about the other condition.

Ouch, nice catch. I completely inverted the condition.

	- Doug



More information about the cfe-commits mailing list