]> granicus.if.org Git - clang/commitdiff
PTHManager::Create() now creates a PTHManager even if the PTH file contains no
authorTed Kremenek <kremenek@apple.com>
Fri, 20 Mar 2009 17:54:25 +0000 (17:54 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 20 Mar 2009 17:54:25 +0000 (17:54 +0000)
cached tokens. This is for use with -include-pth.

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

lib/Lex/PTHLexer.cpp

index 0a810ceaa6b798b51303e532fa21f21cc7b65f4c..e62accb6425cdd8d71eb3f1dfe794bdf2b4b583e 100644 (file)
@@ -648,10 +648,11 @@ PTHManager* PTHManager::Create(const std::string& file, Diagnostic* Diags) {
   }
   
   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 @@ PTHManager* PTHManager::Create(const std::string& file, Diagnostic* Diags) {
 
   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;
   }