]> granicus.if.org Git - clang/commitdiff
Don't bother writing a visible-declarations record for the translation
authorDouglas Gregor <dgregor@apple.com>
Tue, 21 Apr 2009 22:32:33 +0000 (22:32 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 21 Apr 2009 22:32:33 +0000 (22:32 +0000)
unit into the PCH file, since we won't be performing name lookup into
it anyway. Reduces the size of the Carbon.h PCH file by ~200k.

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

lib/Frontend/PCHWriter.cpp

index 993ba9266fc410f39eb50b863b533c66af5f5e98..116725062430f4ab06bb37e14b97f182f35fcc52 100644 (file)
@@ -1595,9 +1595,11 @@ uint64_t PCHWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
   if (DC->getPrimaryContext() != DC)
     return 0;
 
-  // Since there is no name lookup into functions or methods, don't
-  // bother to build a visible-declarations table.
-  if (DC->isFunctionOrMethod())
+  // Since there is no name lookup into functions or methods, and we
+  // perform name lookup for the translation unit via the
+  // IdentifierInfo chains, don't bother to build a
+  // visible-declarations table for these entities.
+  if (DC->isFunctionOrMethod() || DC->isTranslationUnit())
     return 0;
 
   // Force the DeclContext to build a its name-lookup table.