[cfe-commits] r142634 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/ASTImporter.cpp lib/AST/DeclBase.cpp

Douglas Gregor dgregor at apple.com
Thu Oct 20 21:08:08 PDT 2011


On Oct 20, 2011, at 7:57 PM, Sean Callanan wrote:

> Author: spyffe
> Date: Thu Oct 20 21:57:43 2011
> New Revision: 142634
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=142634&view=rev
> Log:
> I added a new function to DeclContext called
> addDeclInternal().  This function suppresses any
> calls to FindExternalVisibleDeclsByName() while
> a Decl is added to a DeclContext.  This behavior
> is required for the ASTImporter, because in the
> case of the LLDB client the ASTImporter would be
> called recursively to import the visible decls,
> which leads to assertions because the recursive
> call is seeing partially-formed types.
> 
> I also modified the ASTImporter to use
> addDeclInternal() in all places where it would
> otherwise use addDecl().  This fix should not
> affect the rest of Clang, passes Clang's
> testsuite, and fixes several serious LLDB bugs.
> 
> Modified:
>    cfe/trunk/include/clang/AST/DeclBase.h
>    cfe/trunk/lib/AST/ASTImporter.cpp
>    cfe/trunk/lib/AST/DeclBase.cpp
> 
> Modified: cfe/trunk/include/clang/AST/DeclBase.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=142634&r1=142633&r2=142634&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/DeclBase.h (original)
> +++ cfe/trunk/include/clang/AST/DeclBase.h Thu Oct 20 21:57:43 2011
> @@ -1231,6 +1231,8 @@
>   /// If D is also a NamedDecl, it will be made visible within its
>   /// semantic context via makeDeclVisibleInContext.
>   void addDecl(Decl *D);
> +    
> +  void addDeclInternal(Decl *D);
> 
>   /// @brief Add the declaration D to this context without modifying
>   /// any lookup tables.
> @@ -1290,6 +1292,9 @@
>   /// the lookup tables because it can be easily recovered by walking
>   /// the declaration chains.
>   void makeDeclVisibleInContext(NamedDecl *D, bool Recoverable = true);
> +    
> +  void makeDeclVisibleInContextInternal(NamedDecl *D,
> +                                        bool Recoverable = true);

Please add Doxygen comments for the two new functions, which explain what they do and why you should never use them if your name isn't "ASTImporter".

	- Doug



More information about the cfe-commits mailing list