building its redecl chains, make sure we pull in the redeclarations of those
canonical declarations.
It's pretty difficult to reach a situation where we can find more canonical
declarations of an entity while building its redecl chains; I think the
provided testcase (4 modules and 7 declarations) cannot be reduced further.
llvm-svn: 232411
// Load pending declaration chains.
for (unsigned I = 0; I != PendingDeclChains.size(); ++I) {
- loadPendingDeclChain(PendingDeclChains[I]);
PendingDeclChainsKnown.erase(PendingDeclChains[I]);
+ loadPendingDeclChain(PendingDeclChains[I]);
}
assert(PendingDeclChainsKnown.empty());
PendingDeclChains.clear();
--- /dev/null
+struct A; // ensure that loading b's canonical decl doesn't load the definition
+struct A {};
--- /dev/null
+#include "a.h" // ensure that our canonical decl is not from b
+struct A;
+#include "b.h"
+struct A;
+#include "c.h" // ensure that our type for A doesn't reference the definition in b
+struct A;
--- /dev/null
+module a { header "a.h" export * }
+module b { header "b.h" export * }
+module c { header "c.h" export * }
+module d { header "d.h" export * }
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/redecl-found-building-chains -verify %s
+// expected-no-diagnostics
+int n, m;
+#include "d.h"
+A a;