Eli Friedman
d5b1f8a842
Change StringRef::startswith and StringRef::endswith to versions which are a
...
bit more verbose, but optimize to much shorter code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 06:49:24 +00:00
Daniel Dunbar
a6d5e40e25
Add an implementation of the delta debugging algorithm.
...
- This is a pretty slow / memory intensive implementation, and I will likely
change it to an iterative model, but it works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 11:12:42 +00:00
Duncan Sands
b83012a180
Only run this mutex test if threading is enabled. This
...
fixes PR5395.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 20:48:14 +00:00
Benjamin Kramer
49123250ae
Reenable Split2 StringRef test with Apple gcc.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 16:04:41 +00:00
Daniel Dunbar
0d753ec30e
"XFAIL" the Split2 StringReft test with Apple gcc, which miscompiles it.
...
- I plan on fixing/workarounding this, but until then I'd like the bots to stay
green.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 09:29:59 +00:00
Rafael Espindola
20fd4ec8c5
Distinguish "a," from "a". The first one splits into "a" + "" and the second one into
...
"a" + 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 04:55:09 +00:00
Rafael Espindola
c78c0c99a0
Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 02:18:25 +00:00
Rafael Espindola
5ccac24726
Add a new split method to StringRef that puts the substrings in a vector.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:24:40 +00:00
Daniel Dunbar
64066bd8b5
Add From arguments to StringRef search functions, and tweak doxyments.
...
Also, add unittests for find_first_of and find_first_not_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:28:53 +00:00
Jeffrey Yasskin
81cf432569
Fix DenseMap iterator constness.
...
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.
The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.
Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.
Patch by Victor Zverovich!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 01:02:17 +00:00
Chris Lattner
f3523592b2
Type.h doesn't need to #include LLVMContext.h
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 17:08:31 +00:00
Chandler Carruth
8b67f774e9
Move DataTypes.h to include/llvm/System, update all users. This breaks the last
...
direct inclusion edge from System to Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Jeffrey Yasskin
4ab74cdc12
Fix stylistic and documentation problems in ValueMap found by Nick Lewycky and
...
Evan Cheng.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 20:54:00 +00:00
Jeffrey Yasskin
71a5c22c2b
Try r84890 again (adding ValueMap<>), now that I've tested the compile on
...
gcc-4.4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:11:22 +00:00
Jeffrey Yasskin
a84c9db467
Revert r84890, which broke the linux build.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 20:23:43 +00:00
Jeffrey Yasskin
e0a234029b
Add a ValueMap<ValueOrSubclass*, T> type. ValueMap<Value*, T> is safe to use
...
even when keys get RAUWed and deleted during its lifetime. By default the keys
act like WeakVHs, but users can pass a third template parameter to configure
how updates work and whether to do anything beyond updating the map on each
action.
It's also possible to automatically acquire a lock around ValueMap updates
triggered by RAUWs and deletes, to support the ExecutionEngine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 20:10:20 +00:00
Duncan Sands
937708cea9
Pacify the compiler (signed with unsigned comparison) by making
...
these constants unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 09:23:11 +00:00
Dan Gohman
cbc7cc63b6
Add a ceilLogBase2 function to APInt.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 01:49:02 +00:00
Daniel Dunbar
393317975c
Fix a few more conversion warnings on 4.0
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 17:48:05 +00:00
Daniel Dunbar
f74610b5e7
Another try at fixing compile warnings on 4.0
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 17:46:53 +00:00
Daniel Dunbar
e65512809a
Add StringRef::{rfind, rsplit}
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:38:48 +00:00
Daniel Dunbar
9c29730bb3
Attempt to fix some 4.0.0 build warnings.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 02:38:53 +00:00
Daniel Dunbar
46e124668a
Simplify, now that gtest supports raw_ostream directly.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 02:31:26 +00:00
Daniel Dunbar
83fecfa42c
Add test for PR4873, which works for me.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 22:57:02 +00:00
Chris Lattner
32e1eef631
split raw_os_ostream out to its own header and implementation file. This
...
means that raw_ostream no longer has to #include <iosfwd>. Nothing in llvm
should use raw_os_ostream.h, but llvm-gcc and some unit tests do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 04:02:06 +00:00
Daniel Dunbar
2571440d1e
Unbreak unit tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 02:02:58 +00:00
Bill Wendling
5504225c2a
Correct for recent assert change.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 06:35:41 +00:00
Erick Tryzelaar
ae8f78d4de
Fix bug with APInt::getBitsNeeded with for base 10 numbers 0-9.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79593 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 03:15:28 +00:00
Erick Tryzelaar
bb97531a5a
Allow '+' to appear in APInt strings, and add more unit tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 03:15:14 +00:00
Erick Tryzelaar
c78b33bdc1
Add support for including '+' in APFloat strings, more asserts,
...
and many new unit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 23:30:43 +00:00
Daniel Dunbar
cdd93d8c35
Fix two APFloat bugs in converting hexadecimal constants.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79540 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 17:12:33 +00:00
Benjamin Kramer
d2a5661d32
Remove SmallString::append_*int* unit tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79451 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 19:41:05 +00:00
Daniel Dunbar
c2da6fb3e5
Add SmallVector::{capacity,set_size}.
...
- These allow clients to make use of the extra elements in the vector which
have already been allocated, without requiring them to be value initialized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 17:48:28 +00:00
Daniel Dunbar
651aa689cc
Improve Triple to recognize the OS in i386-mingw32.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18 19:26:55 +00:00
Daniel Dunbar
323a3e6533
Fix pasto in StringRef::count(char)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18 18:34:22 +00:00
Daniel Dunbar
5caba3bcb1
Add StringRef::count({char,StringRef})
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18 18:26:35 +00:00
Erick Tryzelaar
2ad40a3663
Wrap unit test death tests in GTEST_HAS_DEATH_TEST
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 00:55:33 +00:00
Erick Tryzelaar
33d7dd6dc8
Change APFloatTest from using ASSERTs to EXPECTs
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 00:14:11 +00:00
Erick Tryzelaar
a15d890c34
Modify APFloat to take a StringRef instead of a c string.
...
This also adds unit tests to APFloat that mainly tests the
string handling of APFloat, but not much else of it's api.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 23:36:19 +00:00
Erick Tryzelaar
1b9104ff80
Add failure tests to APInt unit test.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 23:36:01 +00:00
Daniel Dunbar
689ad6ef3f
Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
...
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 02:33:34 +00:00
Daniel Dunbar
0ad7f9bb2f
StringRef: Add find(char) and find(StringRef).
...
Also, regroup functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 20:47:15 +00:00
Daniel Dunbar
0fffbafa96
Twine: Use raw_ostream::write_hex, remove unused itohexstr method.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77617 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 18:30:19 +00:00
Daniel Dunbar
0165a2ca89
Twine: Provide [u]int{32,64} conversions via implicit constructors instead of
...
explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 03:47:15 +00:00
Benjamin Kramer
4baffeb6be
fix unittest on platforms with unsigned chars (e.g. linux-ppc)
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 16:48:32 +00:00
Daniel Dunbar
763457e70b
Twines: Support numeric conversion directly (uitostr, etc).
...
- Provides static constructors for doing number to string conversions without
using temporaries.
- There are several ways to do this, I think given the Twine constraints this
is the simplest one.
- One FIXME for fast number -> hex conversion.
- Added another comment on one last major bit of perf work Twines need, which
is to make raw_svector_ostream more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77445 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 07:08:44 +00:00
Daniel Dunbar
a14d225ef4
Update Triple to use StringRef/Twine based APIs.
...
- This is now shorter, simpler, safer, and more efficient, what a deal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 03:31:47 +00:00
Daniel Dunbar
d61918fc68
Add StringRef::{slice, split}, two convenient string operations which are simple
...
and efficient on a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 03:18:15 +00:00
Jeffrey Yasskin
f595d6dd9a
Add a missing ilist_node.h #include to SparseBitVector, and add a very short
...
test for it. The test is by no means complete, but it tests the problem I was
fixing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 00:33:57 +00:00
Daniel Dunbar
2538f7ab2e
Add Twine ADT.
...
- Not currently used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 07:04:27 +00:00