From c2e7299f26263c29d818ba6a8fe346857eba2017 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 2 Dec 2008 19:57:31 +0000 Subject: [PATCH] Add "-token-cache" option for using pretokenized cache files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60440 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/clang.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 5c89ed0776..2870c3dec0 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -155,6 +155,15 @@ static llvm::cl::opt GenerateDebugInfo("g", llvm::cl::desc("Generate source level debug information")); + +//===----------------------------------------------------------------------===// +// PTH. +//===----------------------------------------------------------------------===// + +static llvm::cl::opt +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; } -- 2.40.0