From: Rafael Espindola Date: Sun, 18 Jul 2010 22:03:55 +0000 (+0000) Subject: Refactor the code a bit so that there is only one call to BuildCompilation. The X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06e35d3d02a1147a448cf08c9c34bc3acccaa63c;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108660 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index c4b12cba0f..8df42246ab 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -248,18 +248,13 @@ int main(int argc, const char **argv) { // Handle QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS, used for editing a // command line behind the scenes. std::set SavedStrings; + std::vector StringPointers(argv, argv + argc); if (const char *OverrideStr = ::getenv("QA_OVERRIDE_GCC3_OPTIONS")) { // FIXME: Driver shouldn't take extra initial argument. - std::vector 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 StringPointers; - // FIXME: Driver shouldn't take extra initial argument. + StringPointers.clear(); StringPointers.push_back(argv[0]); for (;;) { @@ -277,11 +272,9 @@ int main(int argc, const char **argv) { } 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())