]> granicus.if.org Git - clang/commitdiff
Mark the translation unit as having lexical/visible storage only when we actually...
authorDouglas Gregor <dgregor@apple.com>
Fri, 9 Sep 2011 21:09:37 +0000 (21:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 9 Sep 2011 21:09:37 +0000 (21:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139409 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp

index e574e25f5b92ed35167789198d033f7903674196..55dd213286b558ec3b9091e1fad27ae736c47a11 100644 (file)
@@ -2817,6 +2817,11 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
       DeclContextInfo Info = DCU->second;
       (*M)->DeclContextInfos.erase(DCU);
       (*M)->DeclContextInfos[TU] = Info;
+      
+      if (Info.NumLexicalDecls)
+        TU->setHasExternalLexicalStorage();
+      if (Info.NameLookupTableData)
+        TU->setHasExternalVisibleStorage();
     }
   }
   
@@ -2828,10 +2833,6 @@ void ASTReader::InitializeContext(ASTContext &Ctx) {
   // if there are any.
   loadDeclUpdateRecords(PREDEF_DECL_TRANSLATION_UNIT_ID, TU);
   
-  // Note that the translation unit has external lexical and visible storage.
-  TU->setHasExternalLexicalStorage(true);
-  TU->setHasExternalVisibleStorage(true);
-
   // FIXME: Find a better way to deal with collisions between these
   // built-in types. Right now, we just ignore the problem.