[cfe-commits] r110610 - in /cfe/trunk: include/clang/AST/ lib/AST/ lib/Frontend/ lib/Sema/ test/Index/

Sebastian Redl sebastian.redl at getdesigned.at
Mon Aug 9 17:22:28 PDT 2010


On Mon, 9 Aug 2010 17:11:31 -0700, Fariborz Jahanian <fjahanian at apple.com>
wrote:
> On Aug 9, 2010, at 2:55 PM, Sebastian Redl wrote:
>> ======================================================================
>> --- cfe/trunk/lib/AST/DeclObjC.cpp (original)
>> +++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Aug  9 16:55:28 2010
>> @@ -45,6 +45,14 @@
>> // ObjCInterfaceDecl
>> // 
>> = 
>> = 
>> = 
>> ----------------------------------------------------------------------=

>> ==//
>>
>> +ObjCInterfaceDecl *ObjCInterfaceDecl::getDefinition() {
>> +  for (redecl_iterator I = redecls_begin(), E = redecls_end(); I !=  
>> E; ++I) {
>> +    if (I->isDefinition())
>> +      return *I;
>> +  }
>> +  return 0;
>> +}
> 
> Does the API allow you to keep the definition as the first element?  
> This way, you need poke the first element only.

No, redeclarations are supposed to be in source order. Also, the
redeclaration chain is a circle; redecls_begin() starts at the current
element, and the loop continues until it hits the current element again, so
making the definition the first element in the chain wouldn't change
anything.

Sebastian




More information about the cfe-commits mailing list