]> granicus.if.org Git - clang/commitdiff
PCH: When deserializing an explicit "external definition", don't pass it to HandleTop...
authorDaniel Dunbar <daniel@zuster.org>
Thu, 17 Sep 2009 03:06:44 +0000 (03:06 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 17 Sep 2009 03:06:44 +0000 (03:06 +0000)
This is something of a hack, since whether the reader actually did this depends on the "isConsumerInterestedIn" predicate. I think we need to rework how this works, but I need to discuss with Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82111 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReader.cpp
lib/Frontend/PCHReaderDecl.cpp

index e7321bf6fabcaf100e17320c74afbf3e24d7746c..cd08b13547127d91bc20e5b528115a28186a619f 100644 (file)
@@ -2129,9 +2129,9 @@ void PCHReader::StartTranslationUnit(ASTConsumer *Consumer) {
     return;
 
   for (unsigned I = 0, N = ExternalDefinitions.size(); I != N; ++I) {
-    Decl *D = GetDecl(ExternalDefinitions[I]);
-    DeclGroupRef DG(D);
-    Consumer->HandleTopLevelDecl(DG);
+    // Force deserialization of this decl, which will cause it to be passed to
+    // the consumer (or queued).
+    GetDecl(ExternalDefinitions[I]);
   }
 
   for (unsigned I = 0, N = InterestingDecls.size(); I != N; ++I) {
index c3c05b0d5da57edef24b5c662b971b4fc7e3efe1..67ffabba863fc2362e68a83b6adce8c95673f254 100644 (file)
@@ -640,6 +640,8 @@ inline void PCHReader::LoadedDecl(unsigned Index, Decl *D) {
 /// code generation, e.g., inline function definitions, Objective-C
 /// declarations with metadata, etc.
 static bool isConsumerInterestedIn(Decl *D) {
+  if (isa<FileScopeAsmDecl>(D))
+    return true;
   if (VarDecl *Var = dyn_cast<VarDecl>(D))
     return Var->isFileVarDecl() && Var->getInit();
   if (FunctionDecl *Func = dyn_cast<FunctionDecl>(D))
@@ -794,4 +796,3 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) {
 
   return D;
 }
-