]> granicus.if.org Git - clang/commitdiff
Add "-token-cache" option for using pretokenized cache files.
authorTed Kremenek <kremenek@apple.com>
Tue, 2 Dec 2008 19:57:31 +0000 (19:57 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 2 Dec 2008 19:57:31 +0000 (19:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60440 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp

index 5c89ed0776c5453d6ae699a1f272b3d11d63a53a..2870c3dec008e9d781f43622199ab98246d2c9a4 100644 (file)
@@ -155,6 +155,15 @@ static llvm::cl::opt<bool>
 GenerateDebugInfo("g",
                   llvm::cl::desc("Generate source level debug information"));
 
+
+//===----------------------------------------------------------------------===//
+// PTH.
+//===----------------------------------------------------------------------===//
+
+static llvm::cl::opt<std::string>
+TokenCache("token-cache", llvm::cl::value_desc("path"),
+           llvm::cl::desc("Use specified token cache file"));
+
 //===----------------------------------------------------------------------===//
 // Diagnostic Options
 //===----------------------------------------------------------------------===//
@@ -904,6 +913,12 @@ static bool InitializePreprocessor(Preprocessor &PP,
   PredefineBuffer.push_back(0);
   PP.setPredefines(&PredefineBuffer[0]);
   
+  // Use PTH.
+  if (!TokenCache.empty()) {
+    PTHManager* PM = PTHManager::Create(TokenCache, PP);
+    if (PM) PP.setPTHManager(PM);    
+  }
+  
   // Once we've read this, we're done.
   return false;
 }