r175779 - [driver] Handle the processing of the QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS
Chad Rosier
chad.rosier at gmail.com
Tue Jul 23 09:16:48 PDT 2013
Adding cfe-commits..
On Tue, Jul 23, 2013 at 12:15 PM, Chad Rosier <chad.rosier at gmail.com> wrote:
> Rafael,
> IIRC, the QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS are used in various
> Apple environments and there is no real consensus. Since there's no real
> overhead here I propose we just leave it as is.
>
> Daniel may have some additional insight, so I've cc'ed him.
>
> Daniel?
>
> Chad
>
>
> On Tue, Jul 23, 2013 at 11:56 AM, Rafael EspĂndola <
> rafael.espindola at gmail.com> wrote:
>
>> BTW, are both environment variables really needed?
>>
>> On 21 February 2013 13:56, Chad Rosier <mcrosier at apple.com> wrote:
>> > Author: mcrosier
>> > Date: Thu Feb 21 12:56:55 2013
>> > New Revision: 175779
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=175779&view=rev
>> > Log:
>> > [driver] Handle the processing of the QA_OVERRIDE_GCC3_OPTIONS and
>> CCC_ADD_ARGS
>> > before the DiagnosticsEngine is instantiated. Otherwise, warning
>> options are
>> > not handled correctly.
>> > rdar://13254743
>> >
>> > Modified:
>> > cfe/trunk/test/Driver/qa_override.c
>> > cfe/trunk/tools/driver/driver.cpp
>> >
>> > Modified: cfe/trunk/test/Driver/qa_override.c
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/qa_override.c?rev=175779&r1=175778&r2=175779&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/test/Driver/qa_override.c (original)
>> > +++ cfe/trunk/test/Driver/qa_override.c Thu Feb 21 12:56:55 2013
>> > @@ -1,6 +1,13 @@
>> > // RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a
>> +b +c xb Xa Omagic ^-ccc-print-options " %clang x -O2 b -O3 2>&1 |
>> FileCheck %s
>> > +// RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -Werror
>> %s -c 2>&1 | FileCheck %s -check-prefix=RM-WERROR
>> > +
>> > // CHECK-NOT: ###
>> > // CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
>> > // CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"}
>> > // CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"}
>> > // CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"}
>> > +
>> > +// RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-mfoo
>> > +// RM-WERROR-NEXT: ### Deleting argument -Werror
>> > +// RM-WERROR-NEXT: ### Adding argument -mfoo at end
>> > +// RM-WERROR-NEXT: clang: warning: argument unused during compilation:
>> '-mfoo'
>> >
>> > Modified: cfe/trunk/tools/driver/driver.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=175779&r1=175778&r2=175779&view=diff
>> >
>> ==============================================================================
>> > --- cfe/trunk/tools/driver/driver.cpp (original)
>> > +++ cfe/trunk/tools/driver/driver.cpp Thu Feb 21 12:56:55 2013
>> > @@ -373,6 +373,32 @@ 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.
>> > + if (const char *OverrideStr = ::getenv("QA_OVERRIDE_GCC3_OPTIONS")) {
>> > + // FIXME: Driver shouldn't take extra initial argument.
>> > + ApplyQAOverride(argv, OverrideStr, SavedStrings);
>> > + } else if (const char *Cur = ::getenv("CCC_ADD_ARGS")) {
>> > + // FIXME: Driver shouldn't take extra initial argument.
>> > + std::vector<const char*> ExtraArgs;
>> > +
>> > + for (;;) {
>> > + const char *Next = strchr(Cur, ',');
>> > +
>> > + if (Next) {
>> > + ExtraArgs.push_back(SaveStringInSet(SavedStrings,
>> > + std::string(Cur, Next)));
>> > + Cur = Next + 1;
>> > + } else {
>> > + if (*Cur != '\0')
>> > + ExtraArgs.push_back(SaveStringInSet(SavedStrings, Cur));
>> > + break;
>> > + }
>> > + }
>> > +
>> > + argv.insert(&argv[1], ExtraArgs.begin(), ExtraArgs.end());
>> > + }
>> > +
>> > llvm::sys::Path Path = GetExecutablePath(argv[0], CanonicalPrefixes);
>> >
>> > IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new
>> DiagnosticOptions;
>> > @@ -438,32 +464,6 @@ int main(int argc_, const char **argv_)
>> > if (TheDriver.CCLogDiagnostics)
>> > TheDriver.CCLogDiagnosticsFilename =
>> ::getenv("CC_LOG_DIAGNOSTICS_FILE");
>> >
>> > - // Handle QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS, used for
>> editing a
>> > - // command line behind the scenes.
>> > - if (const char *OverrideStr = ::getenv("QA_OVERRIDE_GCC3_OPTIONS")) {
>> > - // FIXME: Driver shouldn't take extra initial argument.
>> > - ApplyQAOverride(argv, OverrideStr, SavedStrings);
>> > - } else if (const char *Cur = ::getenv("CCC_ADD_ARGS")) {
>> > - // FIXME: Driver shouldn't take extra initial argument.
>> > - std::vector<const char*> ExtraArgs;
>> > -
>> > - for (;;) {
>> > - const char *Next = strchr(Cur, ',');
>> > -
>> > - if (Next) {
>> > - ExtraArgs.push_back(SaveStringInSet(SavedStrings,
>> > - std::string(Cur, Next)));
>> > - Cur = Next + 1;
>> > - } else {
>> > - if (*Cur != '\0')
>> > - ExtraArgs.push_back(SaveStringInSet(SavedStrings, Cur));
>> > - break;
>> > - }
>> > - }
>> > -
>> > - argv.insert(&argv[1], ExtraArgs.begin(), ExtraArgs.end());
>> > - }
>> > -
>> > OwningPtr<Compilation> C(TheDriver.BuildCompilation(argv));
>> > int Res = 0;
>> > SmallVector<std::pair<int, const Command *>, 4> FailingCommands;
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130723/9f452ede/attachment.html>
More information about the cfe-commits
mailing list