Revert r299355 "[ASTImporter] Fix for importing unnamed structs"
It breaks windows bots.
llvm-svn: 299386
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 74449a9..9549282 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1221,10 +1221,6 @@
// If the field looks like this:
// struct { ... } A;
QualType FieldType = F->getType();
- // In case of nested structs.
- while (const auto *ElabType = dyn_cast<ElaboratedType>(FieldType)) {
- FieldType = ElabType->getNamedType();
- }
if (const auto *RecType = dyn_cast<RecordType>(FieldType)) {
const RecordDecl *RecDecl = RecType->getDecl();
if (RecDecl->getDeclContext() == Owner &&
@@ -3024,8 +3020,9 @@
}
if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) {
- if (!SearchName) {
- // If both unnamed structs/unions are in a record context, make sure
+ if (D->isAnonymousStructOrUnion() &&
+ FoundRecord->isAnonymousStructOrUnion()) {
+ // If both anonymous structs/unions are in a record context, make sure
// they occur in the same location in the context records.
if (Optional<unsigned> Index1
= findUntaggedStructOrUnionIndex(D)) {