[cfe-commits] r108660 - /cfe/trunk/tools/driver/driver.cpp

Rafael Espindola rafael.espindola at gmail.com
Sun Jul 18 15:03:55 PDT 2010


Author: rafael
Date: Sun Jul 18 17:03:55 2010
New Revision: 108660

URL: http://llvm.org/viewvc/llvm-project?rev=108660&view=rev
Log:
Refactor the code a bit so that there is only one call to BuildCompilation. The
StringPointers vector will also be used in the normal case to handle @file
arguments.

Modified:
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=108660&r1=108659&r2=108660&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Sun Jul 18 17:03:55 2010
@@ -248,18 +248,13 @@
   // Handle QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS, used for editing a
   // command line behind the scenes.
   std::set<std::string> SavedStrings;
+  std::vector<const char*> StringPointers(argv, argv + argc);
   if (const char *OverrideStr = ::getenv("QA_OVERRIDE_GCC3_OPTIONS")) {
     // FIXME: Driver shouldn't take extra initial argument.
-    std::vector<const char*> StringPointers(argv, argv + argc);
-
     ApplyQAOverride(StringPointers, OverrideStr, SavedStrings);
-
-    C.reset(TheDriver.BuildCompilation(StringPointers.size(),
-                                       &StringPointers[0]));
   } else if (const char *Cur = ::getenv("CCC_ADD_ARGS")) {
-    std::vector<const char*> StringPointers;
-
     // FIXME: Driver shouldn't take extra initial argument.
+    StringPointers.clear();
     StringPointers.push_back(argv[0]);
 
     for (;;) {
@@ -277,11 +272,9 @@
     }
 
     StringPointers.insert(StringPointers.end(), argv + 1, argv + argc);
-
-    C.reset(TheDriver.BuildCompilation(StringPointers.size(),
-                                       &StringPointers[0]));
-  } else
-    C.reset(TheDriver.BuildCompilation(argc, argv));
+  }
+  C.reset(TheDriver.BuildCompilation(StringPointers.size(),
+                                     &StringPointers[0]));
 
   int Res = 0;
   if (C.get())





More information about the cfe-commits mailing list