[cfe-commits] r82111 - in /cfe/trunk/lib/Frontend: PCHReader.cpp PCHReaderDecl.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 16 20:06:44 PDT 2009


Author: ddunbar
Date: Wed Sep 16 22:06:44 2009
New Revision: 82111

URL: http://llvm.org/viewvc/llvm-project?rev=82111&view=rev
Log:
PCH: When deserializing an explicit "external definition", don't pass it to HandleTopLevelDecl -- this is already being done inside the reader.

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.

Modified:
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=82111&r1=82110&r2=82111&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Sep 16 22:06:44 2009
@@ -2129,9 +2129,9 @@
     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) {

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=82111&r1=82110&r2=82111&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Wed Sep 16 22:06:44 2009
@@ -640,6 +640,8 @@
 /// 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 @@
 
   return D;
 }
-





More information about the cfe-commits mailing list