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

Daniel Dunbar daniel at zuster.org
Wed Nov 4 17:53:23 PST 2009


Author: ddunbar
Date: Wed Nov  4 19:53:23 2009
New Revision: 86104

URL: http://llvm.org/viewvc/llvm-project?rev=86104&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=86104&r1=86103&r2=86104&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov  4 19:53:23 2009
@@ -2224,7 +2224,8 @@
   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 @@
       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 @@
 
     // Set up the preprocessor with these options.
     llvm::OwningPtr<Preprocessor> PP(CreatePreprocessor(Diags, LangInfo,
-                                                        *Target, *SourceMgr,
+                                                        *Target, SourceMgr,
                                                         HeaderInfo));
 
     // Handle generating dependencies, if requested.





More information about the cfe-commits mailing list