From: Daniel Dunbar Date: Thu, 12 Nov 2009 02:53:13 +0000 (+0000) Subject: Simplify. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6606864161f7d59cffc3e30d42d40c44707d3d59;p=clang Simplify. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86935 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 4f0fd5de45..2648a0b4d8 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -718,6 +718,9 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, } llvm::OwningPtr ContextOwner; + llvm::OwningPtr Source; + const std::string &ImplicitPCHInclude = + CompOpts.getPreprocessorOpts().getImplicitPCHInclude(); if (Consumer) ContextOwner.reset(new ASTContext(PP.getLangOptions(), PP.getSourceManager(), @@ -727,12 +730,6 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, PP.getBuiltinInfo(), /* FreeMemory = */ !DisableFree, /* size_reserve = */0)); - - llvm::OwningPtr Reader; - llvm::OwningPtr Source; - - const std::string &ImplicitPCHInclude = - CompOpts.getPreprocessorOpts().getImplicitPCHInclude(); if (Consumer && !ImplicitPCHInclude.empty()) { // If the user specified -isysroot, it will be used for relocatable PCH // files. @@ -740,6 +737,7 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, if (isysrootPCH[0] == '\0') isysrootPCH = 0; + llvm::OwningPtr Reader; Reader.reset(new PCHReader(PP, ContextOwner.get(), isysrootPCH)); // The user has asked us to include a precompiled header. Load @@ -753,10 +751,8 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, // 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. - if (ContextOwner) { - Source.reset(Reader.take()); - ContextOwner->setExternalSource(Source); - } + Source.reset(Reader.take()); + ContextOwner->setExternalSource(Source); break; }