[cfe-commits] r86935 - /cfe/trunk/tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 11 18:53:13 PST 2009


Author: ddunbar
Date: Wed Nov 11 20:53:13 2009
New Revision: 86935

URL: http://llvm.org/viewvc/llvm-project?rev=86935&view=rev
Log:
Simplify.

Modified:
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86935&r1=86934&r2=86935&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 20:53:13 2009
@@ -718,6 +718,9 @@
   }
 
   llvm::OwningPtr<ASTContext> ContextOwner;
+  llvm::OwningPtr<ExternalASTSource> Source;
+  const std::string &ImplicitPCHInclude =
+    CompOpts.getPreprocessorOpts().getImplicitPCHInclude();
   if (Consumer)
     ContextOwner.reset(new ASTContext(PP.getLangOptions(),
                                       PP.getSourceManager(),
@@ -727,12 +730,6 @@
                                       PP.getBuiltinInfo(),
                                       /* FreeMemory = */ !DisableFree,
                                       /* size_reserve = */0));
-
-  llvm::OwningPtr<PCHReader> Reader;
-  llvm::OwningPtr<ExternalASTSource> 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 @@
     if (isysrootPCH[0] == '\0')
       isysrootPCH = 0;
 
+    llvm::OwningPtr<PCHReader> Reader;
     Reader.reset(new PCHReader(PP, ContextOwner.get(), isysrootPCH));
 
     // The user has asked us to include a precompiled header. Load
@@ -753,10 +751,8 @@
       // 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;
     }
 





More information about the cfe-commits mailing list