Commit Graph

157 Commits

Author SHA1 Message Date
Benjamin Kramer
12ea66a727 Replace strcpy with memcpy when we have the length around anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 18:04:38 +00:00
Duncan Sands
1fa8b00b30 Suppress use of uninitialized variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93046 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 08:30:33 +00:00
David Greene
fcb5b831f6 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92646 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:29:03 +00:00
Dan Gohman
018402d30c Print a newline after the Args: line so that unrelated errs() output doesn't
end up on the same line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 19:03:18 +00:00
Douglas Gregor
b3587cfb3b Perform explicit instantiations in the proper namespace, since Clang diagnoses this ill-formity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 06:04:18 +00:00
Mikhail Glushenkov
37628e0098 Move the handling of CommaSeparated options into ProvideOption.
Makes '--comma-separated val1,val2' mean the same thing as
'--comma-separated=val1,val2' (that is, 'val1' and 'val2' are not lumped
together as 'val1,val2'). Also declutters the main loop a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 17:23:17 +00:00
Mikhail Glushenkov
eeebecfcb4 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 17:29:36 +00:00
Benjamin Kramer
110e7bb25c Revert CPU detection code to return "generic" instead of an empty string in case
of failure. The x86 target didn't like empty cpu names and broke x86 tests on
non-x86 buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 17:57:04 +00:00
Daniel Dunbar
ba43e0785b Report the detected host CPU in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 21:36:07 +00:00
Sandeep Patel
bf177ee6fd Show command-line args and features passed into backend in debug output. Approved by Evan Cheng.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 03:23:46 +00:00
Nicolas Geoffray
35b305863a Bugfix for the CommaSeparated option. The original code was adding the whole
string at the end of the list, instead of the last comma-separated string.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 19:55:53 +00:00
Chris Lattner
63e944b05e reapply r82348 with a fix, thanks Jeffrey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 05:38:36 +00:00
Jeffrey Yasskin
1d75d3a8ae Roll back r82348, which introduced an infinite loop in ParseCStringVector() that
a trivial unittest would have caught.  This revision also adds the trivial
unittest.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 01:14:07 +00:00
Chris Lattner
fd40d038b3 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 07:16:54 +00:00
Chris Lattner
1908aea3a6 smallvectorize getExtraOptionNames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:21:43 +00:00
Chris Lattner
49b301c40a minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:18:38 +00:00
Chris Lattner
bc2d9d3de5 strength reduce further StringRef-> const char*, saving another 620 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:53:47 +00:00
Chris Lattner
043b8b5bb2 switch an std::string to StringRef, shaving 400 bytes off CommandLine.o
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:48:01 +00:00
Chris Lattner
0fd48b1f1c the switch from std::map -> StringMap caused --help output to be in
non-sorted order, restore the sort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:37:24 +00:00
Chris Lattner
d0062c6e7c eliminate the duplicate detection loop, moving it into the loop that populates the Opts vector in the first place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:22:52 +00:00
Chris Lattner
081bcb0d41 Eliminate a masochistic "algorithm" loop, shrinking CommandLine.o from 71524->70700 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:18:28 +00:00
Chris Lattner
b40b7e3faf don't use count + insert, just do insert + failure. Also, instead of deleting from
the middle of a vector, swap the last element in and pop_back.  Also saves 330 bytes :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:15:12 +00:00
Chris Lattner
67aead68be switch to SmallPtrSet instead of std::set, saving 1K from the
release-asserts .o file (72900->71856).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:12:14 +00:00
Chris Lattner
14aae60b69 change an std::sort to an array_pod_sort call, shrinking CommandLine.o by 9%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:06:23 +00:00
Chris Lattner
b168737a74 Several changes together in a murky mess:
1. Change some "\n" -> '\n'.
2. eliminte some std::string's by using raw_ostream::indent.
3. move a bunch of code out of the main arg parser routine into
   a new static HandlePrefixedOrGroupedOption function.
4. Greatly simplify the implementation of getOptionPred, and make
   it avoid splitting prefix options at = when that doesn't match
   a non-prefix option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 05:03:30 +00:00
Daniel Dunbar
256db9bf9d Fix refacto, this code was expecting to stride past the argument prefix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 04:03:41 +00:00
Chris Lattner
8a7a05814c convert argname to StringRef, simplifying LookupOption.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:02:24 +00:00
Chris Lattner
4e247ec495 convert 'Value' to StringRef which makes it easier to
maintain the "null is unspecified, empty is empty" semantics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:53:12 +00:00
Chris Lattner
341620b276 Change CommaSeparated processing to do it with StringRef instead of temporary std::strings.
This requires StringRef'izing ProvideOption which I also did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:49:31 +00:00
Chris Lattner
b7b71a37a1 rewrite ParseCStringVector in terms of stringref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:33:46 +00:00
Chris Lattner
fb2674d0de coding style cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:11:23 +00:00
Chris Lattner
99c5c7b7df convert a bunch more stuff to use StringRef. The ArgName arguments are now
stringref because they may not be nul terminated.  For options like -Lfoo
this now avoids a O(n)  temporary std::strings where N is the length of 
the string after -L.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:40:49 +00:00
Chris Lattner
ba11229f52 avoid a bunch of malloc thrashing for PositinoalVals by eliminating
a std::vector and a bunch of std::string temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:07:40 +00:00
Chris Lattner
970e7dff5b Avoid some temporary strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:59:02 +00:00
Chris Lattner
a460beb5cd convert a bunch of std::strings to use StringRef. This should eliminate
a massive number of temporary strings created when parsing a command line.
More still left to eliminate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 18:55:05 +00:00
Benjamin Kramer
461c87655b Try to speed up the slowest parts of the CommandLine library
- Replace std::map<std::string with StringMap
- Eliminate unnecessary std::string copies
- ~10% speed-up for clang's testsuite on my machine (debug build)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82312 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 10:01:45 +00:00
Daniel Dunbar
6552478ee7 Show derived host triple in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 23:52:38 +00:00
Chris Lattner
ca179340ce clean up #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 18:09:02 +00:00
Benjamin Kramer
d227a3fb1a Remove uses of Streams.h from CommandLine.cpp, fix some whitespace and other minor tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 10:01:13 +00:00
Chris Lattner
d9ea85ab01 remove some uses of llvm/Support/Streams.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 08:43:55 +00:00
Benjamin Kramer
e6864c1d35 Remove duplicated colons and spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 12:13:02 +00:00
Daniel Dunbar
77454a2105 Sort list of targets in --version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 05:09:50 +00:00
Daniel Dunbar
603bea3274 Add registered target list to --version output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 02:06:09 +00:00
Torok Edwin
c23197a26f llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 16:55:14 +00:00
Torok Edwin
c25e7581b9 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 20:10:48 +00:00
Torok Edwin
7d696d8040 Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
and abort()/exit() -> llvm_report_error().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 13:10:19 +00:00
Bill Wendling
b587f9662a Add support for a character after a command line option. Like '-Os'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:26:16 +00:00
Chris Lattner
00a7b52385 Remove AllowInverse: it leaks memory and is not the right
abstraction for CommandLine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:43:51 +00:00
Misha Brukman
d485e885f0 * Fixed spelling of `invertible'
* Simplified if statement


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 00:15:46 +00:00
Chris Lattner
e8b64106ec move a large method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 02:08:47 +00:00