Граф коммитов

62 Коммитов

Автор SHA1 Сообщение Дата
Michael J. Spencer c635710bcb [Options] Add prefixes to options.
Each option has a set of prefixes. When matching an argument such as
-funroll-loops. First the leading - is removed as it is a prefix. Then
a lower_bound search for "funroll-loops" is done against the option table by
option name. From there each option prefix + option name combination is tested
against the argument.

This allows us to support Microsoft style options where both / and - are valid
prefixes. It also simplifies the cases we already have where options come in
both - and -- forms. Almost every option for gnu-ld happens to have this form.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 22:13:48 +00:00
Michael J. Spencer e4151c5d1b [Options] make Option a value type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166347 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19 22:36:40 +00:00
Argyrios Kyrtzidis f385233881 Revert r166223 and the subsequent commits that depend on it, r166230 & r166235.
This seems to have introduced assertion hit when building compiler-rt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166245 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 22:42:31 +00:00
Michael J. Spencer 97b8fd9414 [Options] make Option a value type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166223 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 20:33:42 +00:00
Eric Christopher bc0a925caa Revert "[Options] make Option a value type."
Author: Michael J. Spencer <bigcheesegs@gmail.com>
Date:   Wed Oct 10 21:48:26 2012 +0000

    [Options] make Option a value type.

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165663 91177308-0d34-0410-b5e6-96231b3b80d8

This reverts commit 0464fd5e4c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 22:34:46 +00:00
Michael J. Spencer 0464fd5e4c [Options] make Option a value type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165663 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 21:48:26 +00:00
Benjamin Kramer cbdc1a3432 Prefer StringRef::startswith to the strncmp/strlen contraption.
This may be slightly more efficient and is definitely more readable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165217 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-04 10:06:38 +00:00
Benjamin Kramer 2df1bd4431 Fix invalid reads by memcmp.
Str may be smaller than Start->Name here. Use strncmp to avoid scanning past the
end. Found by valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 20:58:09 +00:00
Michael J. Spencer 9b7dcdb53c [Options] Store the owning OptTable in Option so it can construct Group and Alias.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165150 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 19:58:10 +00:00
Michael J. Spencer 663117ab56 [Options] Store the option ID in OptTable::Info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-25 23:12:48 +00:00
Michael J. Spencer 04a4279160 Reduce the amount of state in the Option class by relying on the data from OptTable::Info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162299 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21 18:51:17 +00:00
Michael J. Spencer 4327557dfa Make Option non virtual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162231 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20 21:41:17 +00:00
James Molloy bfd7a525bc Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.
Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155916 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 14:57:16 +00:00
David Blaikie 548f6c8e80 More missing header inclusions from llvm_unreachable migration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 05:57:42 +00:00
David Blaikie b219cfc4d7 Switch assert(0/false) llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 05:06:16 +00:00
Chris Lattner 5f9e272e63 remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 10:55:15 +00:00
Chris Lattner fc8f0e14ad fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:22:18 +00:00
Nick Lewycky 3fdcc6fb12 Remove stray emacs mode markers in all these files that was causing emacs to
open them in fundamental-mode instead of c++-mode.
Also twiddle whitespace for consistency in ToolChains.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122646 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-31 17:31:54 +00:00
Axel Naumann 9d520c5ae8 Declare argv parameters as const char* const* instead of to char** to clarify that they are not modified, and to allow for string literals as arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 09:18:43 +00:00
Daniel Dunbar caeed1d3a5 Driver/OptParser: Add a NoForward flag to prevent forwarding certain options to
GCC.
 - Mark -Xclang and -mlinker-version= with it for now, although I am sure there
   are more.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111005 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 04:44:20 +00:00
Daniel Dunbar 3177aae51a Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 16:59:23 +00:00
Daniel Dunbar 785e796334 Driver: Change OptTable::ParseArg to take any ArgList.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-11 22:00:17 +00:00
Daniel Dunbar 532c1ec307 Driver: Eliminate Arg subclasses, which are now unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 22:31:08 +00:00
Daniel Dunbar e375c4a02a Driver: Keep the rendering style in the option, instead of as part of the Arg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 22:31:04 +00:00
Daniel Dunbar 4465a776a5 Driver: Change Arg to just hold the values directly, instead of implicitly
deriving them from the Arg type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 22:31:00 +00:00
Daniel Dunbar bbd2a04587 Driver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.
Also, simplify/fix SeparateArg::render with forced join.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 01:12:00 +00:00
Daniel Dunbar 2658f05caf OptTable: Allow option groups to be used to define "help groups", which will
collate the options inside that group.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:08:40 +00:00
Daniel Dunbar 9a242512a8 OptParser: Add HelpHidden flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:08:25 +00:00
Daniel Dunbar 60e107fb86 Add OptTable::PrintHelp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 07:01:38 +00:00
Daniel Dunbar 847abaa628 Factor out OptTable::ParseArgs, for parsing an entire argument vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 06:35:06 +00:00
Daniel Dunbar a0289fda5b Driver: Take option ID for {Input,Unknown}Option, to drop dependency on actual options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89312 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 04:25:06 +00:00
Daniel Dunbar 9e1f98260a Driver: Introduce OptSpecifier class for protecting access to an option id.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 04:14:53 +00:00
Daniel Dunbar 27e738d0d3 Driver: Split OptTable out into OptTable.{h,cpp}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 00:15:11 +00:00
Daniel Dunbar 1ce9cf06b6 Make MSVC happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 21:42:57 +00:00
Daniel Dunbar a79a2b5bf2 Driver: Rework OptTable to have no dependency on the options it manages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 20:19:36 +00:00
Daniel Dunbar a4f64805e0 Driver: Switch Options.def to storing flags as a bitmask (instead of mangled
into a string).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 17:42:34 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Daniel Dunbar 47393ba7ca Explicitly initialize the options array, MinGW's gcc 4.3.5 appears to have a bug
in array value-initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 21:50:47 +00:00
Daniel Dunbar 1e23f5f963 Driver: Add 'q' flag for options which shouldn't be reported as unused.
- <rdar://problem/6756295> warning about '-dynamic' argument unused
   during compilation seems incorrect


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 19:04:18 +00:00
Daniel Dunbar 4ae24e7f11 Driver: Fix a parsing bug where some options were matched
incorrectly. I'm blanking on the smartest way to write this search,
but we should just do the right thing when we move to TableGen.
 - <rdar://problem/6761194> [driver] -Wextra-tokens isn't parsed
   correctly


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 18:21:47 +00:00
Daniel Dunbar febdf7d385 Driver: Add OptTable::getOptionKind.
Also, removed default value for getOptionMetaVar.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 21:26:12 +00:00
Daniel Dunbar c0d12e93ee Driver: Add extra parameters for help text to option definitions.
- Currently unused.

And yes, now may be about the time I want a TableGen backend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:12:05 +00:00
Daniel Dunbar f6dd66b7b8 Driver: Replace Option::ForwardToGCC by Option::DriverOption (which
matches the flag in Options.def).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 06:08:46 +00:00
Daniel Dunbar f3cad36e59 Driver: Prep for tool chain specific argument translation.
- Lift ArgList to a base class for InputArgList and DerivedArgList.
 
 - This is not a great decomposition, but it does embed the
   translation into the type system, and keep things efficient for
   tool chains that don't want to do any translation.

 - No intended functionality change.

Eventually I hope to get rid of tool chain specific translation and
have each tool do the right thing, but for now this is the easiest way
to match gcc precisely (which is good for testing).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 04:13:45 +00:00
Daniel Dunbar cf51ece8f1 gcc 4.3 finds my use of ^ suspicious.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67673 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 03:06:26 +00:00
Daniel Dunbar 7547f74b52 Driver: Make argument parsing fast.
On a synthetic command line consisting of almost all defined options,
this drops wall time from .00494 to .00336 and user time from .00258
to .00105.

On the same benchmark, clang-driver is about 15% faster than the
primary gcc driver and almost twice as fast as the gcc driver driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67564 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 21:50:40 +00:00
Daniel Dunbar 8a7e66d029 Driver: Fix off by one in computation of first searchable option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 19:19:19 +00:00
Daniel Dunbar b355692a7f Driver: Check that options are ordered properly (outside of
Release-Asserts mode).

Also, avoid searching through option groups (which will never match).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 18:41:45 +00:00
Daniel Dunbar b0c4df5c4d Driver: Implement 'missing argument' error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 23:26:43 +00:00
Daniel Dunbar 6d954d7889 Driver: Add "d" flag to Options.def for options which are completely
handled by driver. 
 - This is not very precise, we use it to drive the "forward-to-gcc"
   predicate, when trying to talk to a generic gcc tool.

 - Slightly better than what ccc was doing, and should be good
   enough. Platforms which want a robust driver should implement a
   proper tool chain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 08:01:15 +00:00