summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-27 22:02:30 +0000
committerChris Lattner <sabre@nondot.org>2009-04-27 22:02:30 +0000
commit8804f40321c27394d328b9abe58c2ec8ef2621e1 (patch)
tree87912a84313482b0f3f82634045987a03bb038ae /clang/tools
parent8575daaa825bb2e035463e3b2a88d4d1ed9cb588 (diff)
downloadbcm5719-llvm-8804f40321c27394d328b9abe58c2ec8ef2621e1.tar.gz
bcm5719-llvm-8804f40321c27394d328b9abe58c2ec8ef2621e1.zip
-E, -Eonly and -parse-noop now work with PCH!
llvm-svn: 70259
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/clang-cc/clang-cc.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/tools/clang-cc/clang-cc.cpp b/clang/tools/clang-cc/clang-cc.cpp
index 4f4d3a3fff3..afc57f127d3 100644
--- a/clang/tools/clang-cc/clang-cc.cpp
+++ b/clang/tools/clang-cc/clang-cc.cpp
@@ -1667,12 +1667,8 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
break;
}
- case PrintPreprocessedInput: { // -E mode.
- llvm::TimeRegion Timer(ClangFrontendTimer);
- DoPrintPreprocessedInput(PP, OutputFile);
- ClearSourceMgr = true;
+ case PrintPreprocessedInput:
break;
- }
case ParseNoop:
break;
@@ -1750,19 +1746,23 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
/* FreeMemory = */ !DisableFree,
/* size_reserve = */0,
/* InitializeBuiltins = */ImplicitIncludePCH.empty()));
-
+ llvm::OwningPtr<PCHReader> Reader;
+ llvm::OwningPtr<ExternalASTSource> Source;
+
if (!ImplicitIncludePCH.empty()) {
+ Reader.reset(new PCHReader(PP, ContextOwner.get()));
+
// The user has asked us to include a precompiled header. Load
// the precompiled header into the AST context.
- llvm::OwningPtr<PCHReader> Reader(new PCHReader(PP, ContextOwner.get()));
switch (Reader->ReadPCH(ImplicitIncludePCH)) {
case PCHReader::Success: {
// Attach the PCH reader to the AST context as an external AST
// source, so that declarations will be deserialized from the
// PCH file as needed.
- llvm::OwningPtr<ExternalASTSource> Source(Reader.take());
- if (ContextOwner)
+ if (ContextOwner) {
+ Source.reset(Reader.take());
ContextOwner->setExternalSource(Source);
+ }
// Clear out the predefines buffer, because all of the
// predefines are already in the PCH file.
@@ -1814,6 +1814,10 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
llvm::TimeRegion Timer(ClangFrontendTimer);
ParseFile(PP, new MinimalAction(PP));
ClearSourceMgr = true;
+ } else if (PA == PrintPreprocessedInput){ // -E mode.
+ llvm::TimeRegion Timer(ClangFrontendTimer);
+ DoPrintPreprocessedInput(PP, OutputFile);
+ ClearSourceMgr = true;
}
if (FixItRewrite)
OpenPOWER on IntegriCloud