r202869 - When deciding whether or not to resolve two

Sean Callanan scallanan at apple.com
Tue Mar 4 10:29:11 PST 2014


David,

there is currently no way I’m aware of to test the ASTImporter directly from the clang test suite.  Actually, LLDB is currently the only client for the ASTImporter.
I agree that it would be great to have a unit test infrastructure for the ASTImporter, but that’s a decent-sized chunk of work in itself.

Sean

On Mar 4, 2014, at 10:24 AM, David Blaikie <dblaikie at gmail.com> wrote:

> 
> 
> 
> On Tue, Mar 4, 2014 at 10:11 AM, Sean Callanan <scallanan at apple.com> wrote:
> Author: spyffe
> Date: Tue Mar  4 12:11:50 2014
> New Revision: 202869
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=202869&view=rev
> Log:
> When deciding whether or not to resolve two
> anonymous structs to the same Decl in the
> ASTImporter, ensure that both are filled in
> from their external sources (if present).
> Otherwise two different structs may be
> identified erroneously.
> 
> Test case?
>  
> 
> Modified:
>     cfe/trunk/lib/AST/ASTImporter.cpp
> 
> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=202869&r1=202868&r2=202869&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
> +++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Mar  4 12:11:50 2014
> @@ -2538,6 +2538,21 @@ Decl *ASTNodeImporter::VisitRecordDecl(R
>          } else if (!D->isCompleteDefinition()) {
>            // We have a forward declaration of this type, so adopt that forward
>            // declaration rather than building a new one.
> +
> +          // If one or both can be completed from external storage then try one
> +          // last time to complete and compare them before doing this.
> +
> +          if (FoundRecord->hasExternalLexicalStorage() &&
> +              !FoundRecord->isCompleteDefinition())
> +            FoundRecord->getASTContext().getExternalSource()->CompleteType(FoundRecord);
> +          if (D->hasExternalLexicalStorage())
> +            D->getASTContext().getExternalSource()->CompleteType(D);
> +
> +          if (FoundRecord->isCompleteDefinition() &&
> +              D->isCompleteDefinition() &&
> +              !IsStructuralMatch(D, FoundRecord))
> +            continue;
> +
>            AdoptDecl = FoundRecord;
>            continue;
>          } else if (!SearchName) {
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140304/31b0d603/attachment.html>


More information about the cfe-commits mailing list