[cfe-commits] [PATCH] Add multiple prefixes to Option.

Daniel Dunbar daniel at zuster.org
Fri Oct 19 12:48:02 PDT 2012


On Fri, Oct 19, 2012 at 12:39 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> On Fri, Oct 19, 2012 at 10:38 AM, Daniel Dunbar <daniel at zuster.org> wrote:
>> Hi Michael,
>>
>> I understand what this patch does, but I don't really understand the
>> motivation for it, yet.
>>
>> Why is this the "main feature" needed for sane gnu-ld and link command
>> line support?
>>
>> It seems to me, that what you really need for those is a completely
>> separate option parsing table. I can see how this patch could be
>> useful if you wanted to accept the same options for the link.exe
>> parsing just with a '/' at the front, but that doesn't seem right to
>> me. It seems to me that the link.exe parsing or cl.exe parsing would
>> end up using a completely separate parsing table.
>>
>> Can you explain?
>>
>>  - Daniel
>
> The option tables would be completely separate. This is needed because
> link supports both / and - prefixes for all options. gnu-ld supports -
> and -- for almost all options.

If the option tables are separate, can't we dramatically simplify this
patch by making this a feature of the option table then? So that an
option table can opt in to explicitly specifying all prefixes, and
then we don't need to clutter up the Clang/GCC option table. Option
tables which didn't opt-in to that would be required to supply a list
of possible prefixes.

 - Daniel

> From the ld man page:
>
> "For options whose names are multiple letters, either one dash or two
> can precede the option name; for example, -trace-symbol and
> --trace-symbol are equivalent. Note---there is one exception to this
> rule. Multiple letter options that start with a lower case 'o' can
> only be preceded by two dashes. This is to reduce confusion with the
> -o option. So for example -omagic sets the output file name to magic
> whereas --omagic sets the NMAGIC flag on the output."
>
> - Michael Spencer
>
>>
>> On Thu, Oct 18, 2012 at 3:53 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>>> Hi ddunbar,
>>>
>>> This patch adds support for multiple prefixes per option. This is the main feature needed for sane gnu-ld and link command line support.
>>>
>>> Most of the ["-"]'s can be refactored to a common class in tablegen, but I have a few more widespread tablegen changes I want to make before doing all the refactoring needed.
>>>
>>> http://llvm-reviews.chandlerc.com/D69
>>>
>>> Files:
>>>   include/clang/Driver/Arg.h
>>>   include/clang/Driver/CC1AsOptions.h
>>>   include/clang/Driver/CC1AsOptions.td
>>>   include/clang/Driver/CC1Options.td
>>>   include/clang/Driver/OptParser.td
>>>   include/clang/Driver/OptTable.h
>>>   include/clang/Driver/Option.h
>>>   include/clang/Driver/Options.h
>>>   include/clang/Driver/Options.td
>>>   lib/Driver/Arg.cpp
>>>   lib/Driver/ArgList.cpp
>>>   lib/Driver/CC1AsOptions.cpp
>>>   lib/Driver/Driver.cpp
>>>   lib/Driver/DriverOptions.cpp
>>>   lib/Driver/OptTable.cpp
>>>   lib/Driver/Option.cpp
>>>   lib/Driver/Tools.cpp
>>>   lib/Frontend/CompilerInvocation.cpp
>>>   utils/TableGen/OptParserEmitter.cpp



More information about the cfe-commits mailing list