]> granicus.if.org Git - clang/commitdiff
Simplify.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 5 Nov 2009 01:53:23 +0000 (01:53 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 5 Nov 2009 01:53:23 +0000 (01:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86104 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-cc/clang-cc.cpp

index 3d44d6366a023e5e90e388884f6f35b657eb5391..724f060eddacf275767e7b0ee9a9d74389031801 100644 (file)
@@ -2224,7 +2224,8 @@ int main(int argc, char **argv) {
   if (!InheritanceViewCls.empty())  // C++ visualization?
     ProgAction = InheritanceView;
 
-  llvm::OwningPtr<SourceManager> SourceMgr;
+  // Create the source manager.
+  SourceManager SourceMgr;
 
   // Create a file manager object to provide access to and cache the filesystem.
   FileManager FileMgr;
@@ -2244,12 +2245,9 @@ int main(int argc, char **argv) {
       continue;
     }
 
-    // Create a SourceManager object.  This tracks and owns all the file
-    // buffers allocated to a translation unit.
-    if (!SourceMgr)
-      SourceMgr.reset(new SourceManager());
-    else
-      SourceMgr->clearIDTables();
+    // Reset the ID tables if we are reusing the SourceManager.
+    if (i)
+      SourceMgr.clearIDTables();
 
     // Initialize language options, inferring file types from input filenames.
     LangOptions LangInfo;
@@ -2266,7 +2264,7 @@ int main(int argc, char **argv) {
 
     // Set up the preprocessor with these options.
     llvm::OwningPtr<Preprocessor> PP(CreatePreprocessor(Diags, LangInfo,
-                                                        *Target, *SourceMgr,
+                                                        *Target, SourceMgr,
                                                         HeaderInfo));
 
     // Handle generating dependencies, if requested.