[cfe-commits] r112797 - in /cfe/trunk: docs/tools/clang.pod include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/SemaCXX/borland-extensions.cpp

Douglas Gregor dgregor at apple.com
Thu Sep 2 17:59:08 PDT 2010


Thanks!

Sent from my iPhone

On Sep 2, 2010, at 5:11 PM, dawn at burble.org wrote:

> Recommitted as r112915.  I'm now passing "false" as the third parameter
> to hasFlag:
> 
> +  // -fborland-extensions=0 is default.
> +  if (Args.hasFlag(options::OPT_fborland_extensions,
> +                   options::OPT_fno_borland_extensions, false))
> +    CmdArgs.push_back("-fborland-extensions");
> +
> 
> How's that?
> 
> -Dawn
> 
> 
> On Thu, Sep 02, 2010 at 01:01:00PM -0700, Douglas Gregor wrote:
>> 
>> On Sep 1, 2010, at 7:18 PM, Dawn Perchik wrote:
>> 
>>> Author: dperchik
>>> Date: Wed Sep  1 21:18:55 2010
>>> New Revision: 112797
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=112797&view=rev
>>> Log:
>>> Reverting rev 112791 - apparently -fborland-extensions is on all the time?!
>> 
>> This is a "gotcha" with hasFlag. Fix suggestion is below...
>> 
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=112797&r1=112796&r2=112797&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep  1 21:18:55 2010
>>> @@ -1215,11 +1215,6 @@
>>>                   getToolChain().getTriple().getOS() == llvm::Triple::Win32))
>>>    CmdArgs.push_back("-fms-extensions");
>>> 
>>> -  // -fborland-extensions=0 is default.
>>> -  if (Args.hasFlag(options::OPT_fborland_extensions,
>>> -           options::OPT_fno_borland_extensions))
>>> -    CmdArgs.push_back("-fborland-extensions");
>> 
>> hasFlag has a third argument, which is a boolean that specifies the result of hasFlag if neither of the options is specified. It defaults to "true", which explains why -fborland-extensions was on all the time.
>> 
>> I don't know if you'll want to add a new triple kind for Borland (e.g., so we can have a x86_64-borland-pc target triple), but this argument would be the place to tie Borland extensions to the triple. My guess is that, if you're going to implement the Borland C++ ABI, you'll want a triple to signal it.
>> 
>> When you re-commit, could you intent the second line of the hasFlag call so that the two "options::"'s line up?
>> 
>>    - Doug



More information about the cfe-commits mailing list