]> granicus.if.org Git - clang/commitdiff
The driver/diagnostic client don't need to be on the heap.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 26 May 2009 16:15:44 +0000 (16:15 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 26 May 2009 16:15:44 +0000 (16:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72418 91177308-0d34-0410-b5e6-96231b3b80d8

tools/driver/driver.cpp

index e0f28264287697811364ff9987b0b4725c42461c..804bef4058c9c911dc378d6525f2fedb7eca69ad 100644 (file)
@@ -169,15 +169,13 @@ int main(int argc, const char **argv) {
   llvm::PrettyStackTraceProgram X(argc, argv);
 
   llvm::sys::Path Path = GetExecutablePath(argv[0]);
-  llvm::OwningPtr<DiagnosticClient> 
-    DiagClient(new DriverDiagnosticPrinter(Path.getBasename(), llvm::errs()));
+  DriverDiagnosticPrinter DiagClient(Path.getBasename(), llvm::errs());
 
-  Diagnostic Diags(DiagClient.get());
+  Diagnostic Diags(&DiagClient);
 
-  llvm::OwningPtr<Driver> 
-    TheDriver(new Driver(Path.getBasename().c_str(), Path.getDirname().c_str(),
-                         llvm::sys::getHostTriple().c_str(),
-                         "a.out", Diags));
+  Driver TheDriver(Path.getBasename().c_str(), Path.getDirname().c_str(),
+                   llvm::sys::getHostTriple().c_str(),
+                   "a.out", Diags);
 
   llvm::OwningPtr<Compilation> C;
 
@@ -190,8 +188,8 @@ int main(int argc, const char **argv) {
 
     ApplyQAOverride(StringPointers, OverrideStr, SavedStrings);
 
-    C.reset(TheDriver->BuildCompilation(StringPointers.size(), 
-                                        &StringPointers[0]));
+    C.reset(TheDriver.BuildCompilation(StringPointers.size(), 
+                                       &StringPointers[0]));
   } else if (const char *Cur = ::getenv("CCC_ADD_ARGS")) {
     std::vector<const char*> StringPointers;
 
@@ -214,10 +212,10 @@ int main(int argc, const char **argv) {
 
     StringPointers.insert(StringPointers.end(), argv + 1, argv + argc);
 
-    C.reset(TheDriver->BuildCompilation(StringPointers.size(), 
-                                        &StringPointers[0]));
+    C.reset(TheDriver.BuildCompilation(StringPointers.size(), 
+                                       &StringPointers[0]));
   } else
-    C.reset(TheDriver->BuildCompilation(argc, argv));
+    C.reset(TheDriver.BuildCompilation(argc, argv));
 
   int Res = 0;
   if (C.get())