Fix PR 4489, a crash in PCH loading that occurs when loading the name
of a top-level declaration loads another top-level declaration of the
same name whose type depends on the first declaration having been
completed. This commit breaks the circular dependency by delaying
loads of top-level declarations triggered by loading a name until we
are no longer recursively loading types or declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74847 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/PCH/pr4489.c b/test/PCH/pr4489.c
index 696da5b..5198811 100644
--- a/test/PCH/pr4489.c
+++ b/test/PCH/pr4489.c
@@ -17,4 +17,12 @@
 void y(void) {
   extern char z;
   fprintf (0, "a");
+}
+
+struct y0 { int i; } y0[1] = {};
+
+void x0(void)
+{
+  extern char z0;
+  fprintf (0, "a");
 }
\ No newline at end of file