[ASTImporter] Improve handling of incomplete types
authorSean Callanan <scallanan@apple.com>
Sat, 13 May 2017 00:46:33 +0000 (00:46 +0000)
committerSean Callanan <scallanan@apple.com>
Sat, 13 May 2017 00:46:33 +0000 (00:46 +0000)
commit9092d4795d987d748183fd32ba39035c91949234
tree06dc0aa612da1ae7515dc566ba4ee6222e6e123f
parent4b83b4d560b2afa214b9e532b576a7ff5624f725
[ASTImporter] Improve handling of incomplete types

ASTImporter has some bugs when it's importing types
that themselves come from an ExternalASTSource. This
is exposed particularly in the behavior when
comparing complete TagDecls with forward
declarations. This patch does several things:

- Adds a test case making sure that conflicting
  forward-declarations are resolved correctly;
- Extends the clang-import-test harness to test
  two-level importing, so that we make sure we
  complete types when necessary; and
- Fixes a few bugs I found this way. Failure to
  complete types was one; however, I also discovered
  that complete RecordDecls aren't properly added to
  the redecls chain for existing forward
  declarations.

llvm-svn: 302975
clang/include/clang/AST/ExternalASTMerger.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ASTStructuralEquivalence.cpp
clang/lib/AST/ExternalASTMerger.cpp
clang/test/Import/conflicting-struct/Inputs/S1.cpp [new file with mode: 0644]
clang/test/Import/conflicting-struct/Inputs/S2.cpp [new file with mode: 0644]
clang/test/Import/conflicting-struct/test.cpp [new file with mode: 0644]
clang/tools/clang-import-test/clang-import-test.cpp