r202869 - When deciding whether or not to resolve two
David Blaikie
dblaikie at gmail.com
Tue Mar 4 10:24:07 PST 2014
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/9ae00f3d/attachment.html>
More information about the cfe-commits
mailing list