Commit Graph

1369 Commits

Author SHA1 Message Date
Duncan Sands
12881e79b6 Remove a hack that tries to understand incorrect triples from the
Triple class constructor.  Only valid triples should now be used
inside LLVM - front-ends are now responsable for rejecting or
correcting invalid target triples.  The Triple::normalize method
can be used to straighten out funky triples provided by users.
Give this a whirl through the buildbots to see if I caught all
places where triples enter LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 10:57:54 +00:00
Benjamin Kramer
837bccd052 StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:25:35 +00:00
Benjamin Kramer
0043e35b82 Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 14:21:08 +00:00
Dan Gohman
365c53e328 Use Bits.data() instead of &Bits[0].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111993 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 23:16:53 +00:00
Benjamin Kramer
250eb005d9 Avoid O(n*m) complexity in StringRef::find_first(_not)_of(StringRef).
- Cache used characters in a bitset to reduce memory overhead to just 32 bytes.
- On my core2 this code is faster except when the checked string was very short
  (smaller than the list of delimiters).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 18:16:08 +00:00
Benjamin Kramer
192a400003 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 18:56:46 +00:00
Dan Gohman
8d18006cf2 Delete SlowOperationInformer, which is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 18:07:37 +00:00
Dan Gohman
5d56d9df92 Make outs() close its file when its stream is destructed, so that
pending output errors are detected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 16:44:56 +00:00
Dan Gohman
a1f89deb56 Delete raw_stdout_ostream and raw_stderr_ostream, which are unused
outside of outs() and errs() themselves, and they don't really
need custom classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111642 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 16:39:41 +00:00
Dan Gohman
8df0e01046 Move raw_ostream's Error flag into raw_fd_ostream, as that's the only
class which is using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111639 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 16:34:20 +00:00
Dan Gohman
af0636f4d6 Introduce a new tool_output_file class, which extends raw_ostream with
functionality that most command-line tools need: ensuring that the
output file gets deleted if the tool is interrupted or encounters an
error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 00:48:10 +00:00
Dale Johannesen
b1508d1889 Do not assert when reading an exponent out of range.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 17:58:35 +00:00
Dan Gohman
2499990699 Make raw_fd_ostream consider itself the owner of STDOUT_FILENO when
constructed with an output filename of "-". In particular, allow the
file descriptor to be closed, and close the file descriptor in the
destructor if it hasn't been explicitly closed already, to ensure
that any write errors are detected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 22:26:19 +00:00
Dan Gohman
d77e5a8176 Tidy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 22:04:43 +00:00
Dan Gohman
d2da32711d Revert r111321. This doesn't fix a problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111339 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 01:34:52 +00:00
Chris Lattner
5083912dd7 stomp some more undefined behavior, PR7775.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111337 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 00:33:47 +00:00
Chris Lattner
7942e3c412 include config.h to get config params, hopefully unbreaking mingw builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111325 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 23:22:10 +00:00
Chris Lattner
93d81b697c Fix the rest of rdar://8318441 which happens when a raw_fd_ostream
(e.g. errs()) fails in close() due to (e.g.) a broken pipe.  As
previously written, the had_error() flag would get set and then
the raw_ostream dtor would report a fatal error.  There is nothing
the client can do about this and we have no way to report the error,
so just eat it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111321 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 23:11:56 +00:00
Chris Lattner
73ebaff79f report_fatal_error can't use errs(), because errs() can call
into report_fatal_error.  Just blast the string to stderr with write(2)
and hope for the best!  Part of rdar://8318441


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 23:03:53 +00:00
Daniel Dunbar
ebe7eb884e CrashRecovery: Clear the current context on the first crash, to avoid re-entering it if the cleanup code crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111309 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:32:39 +00:00
Daniel Dunbar
a8fa798246 CrashRecovery: Add CrashRecoveryContext::GetCurrent(), so clients can find the active context from anywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111308 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:32:37 +00:00
Daniel Dunbar
c0c815e887 CrashRecovery: Make CrashRecoveryContext static methods thread safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111307 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:32:34 +00:00
Jim Grosbach
37e59c059c remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111254 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 17:37:22 +00:00
Dan Gohman
3063410e52 Add hooks to FoldingSetTrait to allow specializations to provide
implementations of equality comparison and hash computation. This
can be used to optimize node lookup by avoiding creating lots of
temporary ID values just for hashing and comparison purposes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 15:30:39 +00:00
Dan Gohman
6616f7e2f1 Reverse the order of GetNodeProfile's arguments, for consistency
with FoldingSetTrait::Profile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 14:53:42 +00:00
Duncan Sands
335db22392 Add a 'normalize' method to the Triple class, which takes a mucked up
target triple and straightens it out.  This does less than gcc's script
config.sub, for example it turns i386-mingw32 into i386--mingw32 not
i386-pc-mingw32, but it does a decent job of turning funky triples into
something that the rest of the Triple class can understand.  The plan
is to use this to canonicalize triple's when they are first provided
by users, and have the rest of LLVM only deal with canonical triples.
Once this is done the special case workarounds in the Triple constructor
can be removed, making the class more regular and easier to use.  The
comments and unittests for the Triple class are already adjusted in this
patch appropriately for this brave new world of increased uniformity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 11:31:39 +00:00
Nick Lewycky
7f9ef4bb51 Clean up ConstantRange a bit:
- remove ashr which never worked.
 - fix lshr and shl and add tests.
 - remove dead function "intersect1Wrapped".
 - add a new sub method to subtract ranges, with test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110861 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 22:04:36 +00:00
Eric Christopher
371e5774c7 Fix a couple of warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-08 00:00:34 +00:00
Benjamin Kramer
fff0f11989 Roll back my last two commits, valgrind complains.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110518 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 13:27:41 +00:00
Benjamin Kramer
933b16e665 Kill rarely used std::sort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 12:37:00 +00:00
Owen Anderson
0aede9e2a8 Remove layering violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110505 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 06:01:13 +00:00
Owen Anderson
9773e45a1e Add an inverse() method to ConstantRange.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 05:47:46 +00:00
Owen Anderson
634bab148c Add a convenience constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 00:42:06 +00:00
Chris Lattner
e211cd83f0 avoid undef behavior on minint, fixing PR7783.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 16:41:24 +00:00
Daniel Dunbar
63cc2e1982 Fix -Wmissing-field-initializers warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 17:49:04 +00:00
Daniel Dunbar
a685582048 CrashRecovery: Use ThreadLocal::erase() instead of set(0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109752 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 15:24:21 +00:00
Daniel Dunbar
dade28ee4e Make sure to include config.h, to pickup LLVM_ON_WIN32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109721 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 01:52:04 +00:00
Daniel Dunbar
d9082dfd9a CrashRecoveryContext: Add a simple POSIX implementation.
- This works, but won't handle crashes on stack overflow, or signals delivered
   to a thread other than the one that crashed. The latter is particular annoying
   on Darwin, because SIGABRT tends to go to the main thread.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 01:21:47 +00:00
Douglas Gregor
c19d865474 Unbreak my CMake build, say you'll compile for me again...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 17:17:46 +00:00
Daniel Dunbar
a309dac868 Support: Add CrashRecoveryContext helper object.
- Designed as a simple wrapper to allow clients to attempt to catch crashes
   (memory errors, assertion violations, etc.) and do some kind of recovery.

 - Currently doesn't actually attempt to catch crashes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 15:40:20 +00:00
Benjamin Kramer
38e59891ee Don't pass StringRef by reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108366 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 22:38:02 +00:00
Chris Lattner
29269d03af add some triple for minix, patch by Kees van Reeuwijk from PR7582
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 15:52:27 +00:00
Duncan Sands
2a8bf425bd Rather than giving SmallPtrSetImpl a member field SmallArray which is magically
replaced by a bigger array in SmallPtrSet (by overridding it), instead just use a
pointer to the start of the storage, and have SmallPtrSet pass in the value to use.
This has the disadvantage that SmallPtrSet becomes bigger by one pointer.  It has
the advantage that it no longer uses tricky C++ rules, and is clearly correct while
I'm not sure the previous version was.  This was inspired by g++-4.6 pointing out
that SmallPtrSetImpl was writing off the end of SmallArray, which it was.  Since
SmallArray is replaced with a bigger array in SmallPtrSet, the write was still to
valid memory.  But it was writing off the end of the declared array type - sounds
kind of dubious to me, like it sounded dubious to g++-4.6.  Maybe g++-4.6 is wrong
and this construct is perfectly valid and correctly compiled by all compilers, but
I think it is better to avoid the whole can of worms by avoiding this construct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 15:02:37 +00:00
Eric Christopher
7d59a9766c Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 18:33:48 +00:00
Eric Christopher
4411fbe25e Pull in the libCrashReporterClient.a information with a warning comment.
Remove library check and regenerate configure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 18:25:51 +00:00
Benjamin Kramer
831338b320 Rewrite MemoryBuffer::getSTDIN to use read(2) and a SmallVector buffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 16:07:18 +00:00
Benjamin Kramer
7262c19c41 Bring back the empty vector workaround I removed in r106839. Looks like MSVC needs it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106841 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 12:51:01 +00:00
Benjamin Kramer
d4d1f85aa7 Tweak MemoryBuffer to allocate the class itself, the name and possibly the
buffer in the same chunk of memory.

2 less mallocs for every uninitialized MemoryBuffer and 1 less malloc for every
MemoryBuffer pointing to a memory range translate into 20% less mallocs on
clang -cc1 -Eonly Cocoa_h.m.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 11:50:40 +00:00
Dan Gohman
60e6f3d412 Add overloads for getFile and getFileOrSTDIN which take a const char *
instead of a StringRef, avoiding the need to copy the string in the
common case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:25:50 +00:00
Eric Christopher
654dee4875 Look for and use a different darwin crash reporter library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106576 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 21:01:04 +00:00