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

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


Author: ddunbar
Date: Wed Nov 11 20:53:06 2009
New Revision: 86934

URL: http://llvm.org/viewvc/llvm-project?rev=86934&view=rev
Log:
clang-cc: Unify InitializeSourceManager calls.

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=86934&r1=86933&r2=86934&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 20:53:06 2009
@@ -717,7 +717,6 @@
     }
   }
 
-
   llvm::OwningPtr<ASTContext> ContextOwner;
   if (Consumer)
     ContextOwner.reset(new ASTContext(PP.getLangOptions(),
@@ -770,27 +769,18 @@
       // No suitable PCH file could be found. Return an error.
       return;
     }
-
-    // Finish preprocessor initialization. We do this now (rather
-    // than earlier) because this initialization creates new source
-    // location entries in the source manager, which must come after
-    // the source location entries for the PCH file.
-    if (InitializeSourceManager(PP, InFile))
-      return;
-  } else if (!ImplicitPCHInclude.empty()) {
-    // If we have an implicit PCH, the source manager initialization was
-    // delayed, do it now.
-    //
-    // FIXME: Clean this up.
-
-    // Finish preprocessor initialization. We do this now (rather
-    // than earlier) because this initialization creates new source
-    // location entries in the source manager, which must come after
-    // the source location entries for the PCH file.
-    if (InitializeSourceManager(PP, InFile))
-      return;
   }
 
+  // Initialize the main file entry. This needs to be delayed until after PCH
+  // has loaded.
+  if (InitializeSourceManager(PP, InFile))
+    return;
+
+  // Initialize builtin info unless we are using PCH.
+  if (!Consumer || ImplicitPCHInclude.empty())
+    PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
+                                           PP.getLangOptions().NoBuiltin);
+
   // If we have an ASTConsumer, run the parser with it.
   if (Consumer) {
     CodeCompleteConsumer *(*CreateCodeCompleter)(Sema &, void *) = 0;
@@ -1232,15 +1222,6 @@
                             CompOpts.getDependencyOutputOpts(),
                             *Target, SourceMgr, FileMgr));
 
-    if (CompOpts.getPreprocessorOpts().getImplicitPCHInclude().empty()) {
-      if (InitializeSourceManager(*PP.get(), InFile))
-        continue;
-
-      // Initialize builtin info.
-      PP->getBuiltinInfo().InitializeBuiltins(PP->getIdentifierTable(),
-                                              PP->getLangOptions().NoBuiltin);
-    }
-
     // Process the source file.
     Diags.getClient()->BeginSourceFile(CompOpts.getLangOpts());
     ProcessInputFile(CompOpts, *PP, InFile, ProgAction, Context);





More information about the cfe-commits mailing list