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

Fariborz Jahanian fjahanian at apple.com
Mon Aug 9 17:11:31 PDT 2010


On Aug 9, 2010, at 2:55 PM, Sebastian Redl wrote:

> Author: cornedbee
> Date: Mon Aug  9 16:55:28 2010
> New Revision: 110610
>
> URL: http://llvm.org/viewvc/llvm-project?rev=110610&view=rev
> Log:
> - Make ObjCInterfaceDecl redeclarable, and create separate decl  
> nodes for forward declarations and the definition.
> - Eagerly create ObjCInterfaceTypes for declarations.
> - The two above changes lead to a 0.5% increase in memory use and no  
> speed regression when parsing Cocoa.h. On the other hand, now  
> chained PCH works when there's a forward declaration in one PCH and  
> the interface definition in another.
> - Add HandleInterestingDecl to ASTConsumer. PCHReader passes the  
> "interesting" decls it finds to this function instead of  
> HandleTopLevelDecl. The default implementation forwards to  
> HandleTopLevelDecl, but ASTUnit's handler for example ignores them.  
> This fixes a potential crash when lazy loading of PCH data would  
> cause ASTUnit's "top level" declaration collection to change while  
> being iterated.
>
>
> Modified: cfe/trunk/lib/AST/DeclObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=110610&r1=110609&r2=110610&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- 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.

- Fariborz




More information about the cfe-commits mailing list