summaryrefslogtreecommitdiff
path: root/unittests/ADT
Commit message (Collapse)AuthorAge
* Silence 'unused' warning.Bill Wendling2010-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111539 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a 'normalize' method to the Triple class, which takes a mucked upDuncan Sands2010-08-12
| | | | | | | | | | | | | | | | 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
* Remove the ValueMap copy constructor. It's not used anywhere,Duncan Sands2010-08-08
| | | | | | | | and removing it catches the mistake of passing a ValueMap by copy rather than by reference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110549 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the ValueMap copy constructor. The issue is that the map keys are valueDuncan Sands2010-07-30
| | | | | | | | | | | | | | | | | handles with a pointer to the containing map. When a map is copied, these pointers need to be corrected to point to the new map. If not, then consider the case of a map M1 which maps a value V to something. Create a copy M2 of M1. At this point there are two value handles on V, one representing V as a key in M1, the other representing V as a key in M2. But both value handles point to M1 as the containing map. Now delete V. The value handles remove themselves from their containing map (which destroys them), but only the first value handle is successful: the second one cannot remove itself from M1 as (once the first one has removed itself) there is nothing there to remove; it is therefore not destroyed. This causes an assertion failure "All references to V were not removed?". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109851 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch from EXPECT_EQ({true,false, ...) to the more canonicalChandler Carruth2010-07-13
| | | | | | | | EXPECT_{TRUE,FALSE}(...) macros. This also prevents suprious warnings about bool-to-pointer conversion that occurs withit EXPECT_EQ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108248 91177308-0d34-0410-b5e6-96231b3b80d8
* Use non-bool values for .count.Bill Wendling2010-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108048 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on ↵Daniel Dunbar2010-06-08
| | | | | | | | top of the standard 'delta debugging' algorithm. - This can give substantial speedups in the delta process for inputs we can construct dependency information for. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105612 91177308-0d34-0410-b5e6-96231b3b80d8
* Add StringRef::compare_numeric and use it to sort TableGen register records.Jakob Stoklund Olesen2010-05-26
| | | | | | | This means that our Registers are now ordered R7, R8, R9, R10, R12, ... Not R1, R10, R11, R12, R2, R3, ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104745 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.Daniel Dunbar2010-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103723 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT: Add ilist_node::get{Prev,Next}Node, which return the adjacent node or null.Daniel Dunbar2010-05-12
| | | | | | | | | | | | | | | | | | | | - This provides a convenient alternative to using something llvm::prior or manual iterator access, for example:: if (T *Prev = foo->getPrevNode()) ... instead of:: iterator it(foo); if (it != begin()) { --it; ... } - Chris, please review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103647 91177308-0d34-0410-b5e6-96231b3b80d8
* Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,Dan Gohman2010-04-30
| | | | | | | and fix a bug in BitVector's reference proxy class which this exposed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102768 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallBitVector: Rework find_first/find_next and tweak test to test them (at ↵Benjamin Kramer2010-04-30
| | | | | | least on 64 bit platforms). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102712 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a read/write operator[] for SmallBitVector with a proxy class.Benjamin Kramer2010-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102709 91177308-0d34-0410-b5e6-96231b3b80d8
* silence some unused-value warnings.Chris Lattner2010-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101689 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SmallVector's insert to handle non-random-access iterators.Dan Gohman2010-03-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99633 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this test more lenient; with SmallVector now using actuallyDan Gohman2010-03-18
| | | | | | | | aligned storage, the capacity may be more than what is explicitly requested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98846 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix death tests in -Asserts builds.Jeffrey Yasskin2010-03-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98701 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-widthJohn McCall2010-02-28
| | | | | | | | | | payloads. APFloat's internal folding routines always make QNaNs now, instead of sometimes making QNaNs and sometimes SNaNs depending on the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97364 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APFloat's string-parsing routines a bit safer against very large exponents.John McCall2010-02-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97278 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix (harmless) memory leak found by memcheck.Jeffrey Yasskin2010-02-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95862 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence GCC warnings.Benjamin Kramer2010-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95779 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement operators |=, &=, and ^= for SmallBitVector, and remove theDan Gohman2010-02-10
| | | | | | | | restriction in BitVector for |= and ^= that the operand must be the same length. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95768 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable unittests/ADT/BitVectorTest on PPC Darwin.Dale Johannesen2010-02-09
| | | | | | | | | | | It fails with a release build only, for reasons as yet unknown. (If there's a better way to Xfail things here let me know, doesn't seem to be any prior art in unittests.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95700 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APInt::countLeadingZerosSlowCase() treat the contents of padding bitsJohn McCall2010-02-03
| | | | | | | | as undefined. Fixes an assertion in APFloat::toString noticed by Dale. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95196 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a SmallBitVector class, which mimics BitVector but uses onlyDan Gohman2010-01-05
| | | | | | | | | | | | | a single pointer (PointerIntPair) member. In "small" mode, the pointer field is reinterpreted as a set of bits. In "large" mode, the pointer points to a heap-allocated object. Also, give BitVector empty and swap functions. And, add some simple unittests for BitVector and SmallBitVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92730 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence compiler warning.Benjamin Kramer2009-12-31
| | | | | | | warning: comparison between signed and unsigned integer expressions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92359 91177308-0d34-0410-b5e6-96231b3b80d8
* Document the edit-distance algorithm used in StringRef, switch it overDouglas Gregor2009-12-31
| | | | | | | to SmallVector, and add a unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement support for converting to string at "natural precision", and fix someJohn McCall2009-12-24
| | | | | | | | major bugs in long-precision conversion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92150 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the two definitions of operator<< into namespace llvm, so theyDouglas Gregor2009-12-24
| | | | | | | | will be found by argument-dependent lookup. As with the previous commit, GCC is allowing ill-formed code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92146 91177308-0d34-0410-b5e6-96231b3b80d8
* Define the new operator<< for sets into namespace std, so thatDouglas Gregor2009-12-24
| | | | | | | | | argument-dependent lookup can find it. This is another case where an LLVM bug (not making operator<< visible) was masked by a GCC bug (looking in the global namespace when it shouldn't). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92144 91177308-0d34-0410-b5e6-96231b3b80d8
* Add accessors for the largest-magnitude, smallest-magnitude, andJohn McCall2009-12-24
| | | | | | | | | | smallest-normalized-magnitude values in a given FP semantics. Provide an APFloat-to-string conversion which I am quite ready to admit could be much more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92126 91177308-0d34-0410-b5e6-96231b3b80d8
* Change StringRef::startswith and StringRef::endswith to versions which are aEli Friedman2009-12-21
| | | | | | | | 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
* Add an implementation of the delta debugging algorithm.Daniel Dunbar2009-12-03
| | | | | | | - 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
* Only run this mutex test if threading is enabled. ThisDuncan Sands2009-11-19
| | | | | | | fixes PR5395. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89385 91177308-0d34-0410-b5e6-96231b3b80d8
* Reenable Split2 StringRef test with Apple gcc.Benjamin Kramer2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89357 91177308-0d34-0410-b5e6-96231b3b80d8
* "XFAIL" the Split2 StringReft test with Apple gcc, which miscompiles it.Daniel Dunbar2009-11-17
| | | | | | | - 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
* Distinguish "a," from "a". The first one splits into "a" + "" and the second ↵Rafael Espindola2009-11-13
| | | | | | | | | one into "a" + 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87084 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to smallvector. Also fix issue with using unsigend for MaxSplit.Rafael Espindola2009-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87068 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new split method to StringRef that puts the substrings in a vector.Rafael Espindola2009-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87058 91177308-0d34-0410-b5e6-96231b3b80d8
* Add From arguments to StringRef search functions, and tweak doxyments.Daniel Dunbar2009-11-11
| | | | | | 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
* Fix DenseMap iterator constness.Jeffrey Yasskin2009-11-10
| | | | | | | | | | | | | | | | | | | | 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
* Type.h doesn't need to #include LLVMContext.hChris Lattner2009-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85254 91177308-0d34-0410-b5e6-96231b3b80d8
* Move DataTypes.h to include/llvm/System, update all users. This breaks the lastChandler Carruth2009-10-26
| | | | | | | direct inclusion edge from System to Support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix stylistic and documentation problems in ValueMap found by Nick Lewycky andJeffrey Yasskin2009-10-23
| | | | | | | Evan Cheng. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84967 91177308-0d34-0410-b5e6-96231b3b80d8
* Try r84890 again (adding ValueMap<>), now that I've tested the compile onJeffrey Yasskin2009-10-22
| | | | | | | gcc-4.4. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84902 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r84890, which broke the linux build.Jeffrey Yasskin2009-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84892 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ValueMap<ValueOrSubclass*, T> type. ValueMap<Value*, T> is safe to useJeffrey Yasskin2009-10-22
| | | | | | | | | | | | | 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
* Pacify the compiler (signed with unsigned comparison) by makingDuncan Sands2009-10-13
| | | | | | | these constants unsigned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83962 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ceilLogBase2 function to APInt.Dan Gohman2009-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83932 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a few more conversion warnings on 4.0Daniel Dunbar2009-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82232 91177308-0d34-0410-b5e6-96231b3b80d8