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

Michael Spencer bigcheesegs at gmail.com
Fri Oct 19 12:39:35 PDT 2012


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.

>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