[cfe-commits] r67385 - /cfe/trunk/lib/Lex/PTHLexer.cpp

Ted Kremenek kremenek at apple.com
Fri Mar 20 10:54:25 PDT 2009


Author: kremenek
Date: Fri Mar 20 12:54:25 2009
New Revision: 67385

URL: http://llvm.org/viewvc/llvm-project?rev=67385&view=rev
Log:
PTHManager::Create() now creates a PTHManager even if the PTH file contains no
cached tokens. This is for use with -include-pth.

Modified:
    cfe/trunk/lib/Lex/PTHLexer.cpp

Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=67385&r1=67384&r2=67385&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Fri Mar 20 12:54:25 2009
@@ -648,10 +648,11 @@
   }
   
   llvm::OwningPtr<PTHFileLookup> FL(PTHFileLookup::Create(FileTable, BufBeg));
-  if (FL->isEmpty()) {
+  
+  // Warn if the PTH file is empty.  We still want to create a PTHManager
+  // as the PTH could be used with -include-pth.
+  if (FL->isEmpty())
     InvalidPTH(Diags, "PTH file contains no cached source data");
-    return 0;
-  }
   
   // Get the location of the table mapping from persistent ids to the
   // data needed to reconstruct identifiers.
@@ -674,7 +675,7 @@
 
   llvm::OwningPtr<PTHStringIdLookup> SL(PTHStringIdLookup::Create(StringIdTable,
                                                                   BufBeg));
-  if (SL->isEmpty()) {
+  if (!FL->isEmpty() && SL->isEmpty()) {
     InvalidPTH(Diags, "PTH file contains no identifiers.");
     return 0;
   }





More information about the cfe-commits mailing list