summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix rare case where APInt divide algorithm applied un-needed transformation.Yaron Keren2015-03-261-0/+200
| | | | | | | | | | | | | | | APInt uses Knuth's D algorithm for long division. In rare cases the implementation applied a transformation that was not needed. Added unit tests for long division. KnuthDiv() procedure is fully covered. There is a case in APInt::divide() that I believe is never used (marked with a comment) as all users of divide() handle trivial cases earlier. Patch by Pawel Bylica! http://reviews.llvm.org/D8448 llvm-svn: 233312
* [APInt] Add an isSplat helper and use it in some places.Benjamin Kramer2015-03-251-0/+40
| | | | | | | To complement getSplat. This is more general than the binary decomposition method as it also handles non-pow2 splat sizes. llvm-svn: 233195
* [ADT] Teach MapVector to support a swap member. Will be used inChandler Carruth2015-03-251-0/+25
| | | | | | a subsequent commit in Clang. llvm-svn: 233159
* Teach Twine to support SmallString.Yaron Keren2015-03-171-0/+10
| | | | | | | | Enable removing .str() member calls for these frequent cases. http://reviews.llvm.org/D6372 llvm-svn: 232465
* [llvm] Replacing asserts with static_asserts where appropriateGabor Horvath2015-03-161-1/+1
| | | | | | | | | | | | | | | | Summary: This patch consists of the suggestions of clang-tidy/misc-static-assert check. Reviewers: alexfh Reviewed By: alexfh Subscribers: xazax.hun, llvm-commits Differential Revision: http://reviews.llvm.org/D8343 llvm-svn: 232366
* Add support for Nuxi CloudABI.Ed Schouten2015-03-091-0/+6
| | | | | | | | | | | | | | CloudABI is a POSIX-like runtime environment built around the concept of capability-based security. More details: https://github.com/NuxiNL/cloudlibc CloudABI uses its own ELFOSABI number. This number has been allocated by the maintainers of ELF a couple of days ago. Reviewed by: echristo llvm-svn: 231681
* Drop the hacks used for partial C99 math libraries.Benjamin Kramer2015-03-091-3/+4
| | | | | | All supported platforms have half-way decent C99 support. llvm-svn: 231679
* Explicitly default ilistTest::Node's copy constructorDavid Blaikie2015-03-041-1/+2
| | | | | | | In the presence of a user-declared dtor, calling an implicit copy ctor is deprecated in C++11. llvm-svn: 231256
* Explicitly default DenseMapTest::CtorTest::operator=David Blaikie2015-03-041-0/+1
| | | | | | | Using the implicit default copy assignment operator in the presence of a user-declared copy ctor is deprecated in C++11. llvm-svn: 231225
* Revert "Remove the explicit SDNodeIterator::operator= in favor of the ↵David Blaikie2015-03-032-4/+1
| | | | | | | | | | | implicit default" Accidentally committed a few more of these cleanup changes than intended. Still breaking these out & tidying them up. This reverts commit r231135. llvm-svn: 231136
* Remove the explicit SDNodeIterator::operator= in favor of the implicit defaultDavid Blaikie2015-03-032-1/+4
| | | | | | | | | | There doesn't seem to be any need to assert that iterator assignment is between iterators over the same node - if you want to reuse an iterator variable to iterate another node, that's perfectly acceptable. Just don't mix comparisons between iterators into disjoint sequences, as usual. llvm-svn: 231135
* DeltaAlgorithm: Provide protected default copy ctor for use by test derived ↵David Blaikie2015-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | class. Without this, use of this copy ctor is deprecated in C++11 due to the presence of a user-declared dtor. Marking the class final is just a little extra security that there are no further derived classes that may then end up using the intermediate base class's copy assignment operator and cause slicing to occur. I didn't bother marking the other (non-test) base class final, since it has reference members so it won't have any implicit assignment operators anyway. Open to ideas on that, though. We probably want a warning about use of a slicing assignment operator, then I wouldn't worry so much about marking the class as final. llvm-svn: 231114
* Remove no-op dtor so that use of the implicit copy ctor/assignment operator ↵David Blaikie2015-03-031-1/+0
| | | | | | are not deprecated. llvm-svn: 231112
* Remove explicit copy ctor in favor of the default so as not to ↵David Blaikie2015-03-031-2/+0
| | | | | | disable/deprecate the implicit copy assignment operator llvm-svn: 231108
* SmallVector: Allow initialization and assignment from initializer_list.Benjamin Kramer2015-03-021-0/+19
| | | | | | Modeled after std::vector. llvm-svn: 231015
* ArrayRef: Remove the equals helper with many arguments.Benjamin Kramer2015-03-011-14/+14
| | | | | | | | | | | | | With initializer lists there is a really neat idiomatic way to write this, 'ArrayRef.equals({1, 2, 3, 4, 5})'. Remove the equal method which always had a hard limit on the number of arguments. I considered rewriting it with variadic templates but that's not really a good fit for a function with homogeneous arguments. 'ArrayRef == {1, 2, 3, 4, 5}' would've been even more awesome, but C++11 doesn't allow init lists with binary operators. llvm-svn: 230907
* Correcting the ArrayRef test to not cause use-after-free bugs with ↵Aaron Ballman2015-02-171-3/+5
| | | | | | initializer lists. Should also silence a -Wsign-compare warning accidentally introduced. llvm-svn: 229515
* Adding additional tests to ensure that initializer lists created from return ↵Aaron Ballman2015-02-171-0/+13
| | | | | | values and as function arguments also work as expected. llvm-svn: 229513
* Addressing a post-commit review comment suggesting to avoid using direct ↵Aaron Ballman2015-02-171-1/+1
| | | | | | initialization. llvm-svn: 229512
* I believe we no longer require LLVM_HAS_INITIALIZER_LISTS; it's supported in ↵Aaron Ballman2015-02-171-0/+6
| | | | | | | | MSVC 2013 and GCC. Added a trivial test to ensure the ArrayRef initializer list constructor is called and behaves as expected. If any of the bots complain (perhaps due to an antiquated version of an STL implementation), I will revert. llvm-svn: 229502
* ADT/PointerIntPairTest.cpp: Prune obsolete #if. We don't support msc17 anymore.NAKAMURA Takumi2015-02-171-2/+0
| | | | llvm-svn: 229501
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-153-15/+15
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* ADT: Allow up to 18 arguments in hash_combine()Duncan P. N. Exon Smith2015-02-091-0/+25
| | | | | | | | | I just realized that the specialized metadata node patch I'm about to commit won't compile on old compilers. Bump `hash_combine()`'s support for non-variadic templates to 18 (I tested this by reversing the logic in the #ifdef). llvm-svn: 228629
* SmallVector: Move emplace_back to SmallVectorImpl.Benjamin Kramer2015-02-071-0/+8
| | | | | | | This resolves the strange effect that emplace_back is only available when the type contained in the vector is not trivially copyable. llvm-svn: 228496
* ADT: Add int64_t interoperability to APSIntDuncan P. N. Exon Smith2015-02-051-0/+102
| | | | | | | | | | | | | | | | Add some API to `APSInt` to make it easier to compare with `int64_t`. - `APSInt::compareValues(APSInt, APSInt)` returns 1, -1 or 0 for greater, lesser, or equal, doing the right thing for mismatched "has-sign" and bitwidths. This is just like `isSameValue()` (and is now the implementation of it). - `APSInt::get(int64_t)` gets a signed `APSInt`. - `operator<(int64_t)`, etc., are implemented trivially via `get()` and `compareValues()`. - Also added `APSInt::getUnsigned(uint64_t)` to make it easier to test `compareValues()`. llvm-svn: 228239
* The canonical CPU variant for ARM according to config.guess uses aJoerg Sonnenberger2015-01-261-0/+17
| | | | | | | | | | | | | | | | suffix it seems: # ./config.guess earmv7hfeb-unknown-netbsd7.99.4 Extend the triple parsing to support this. Avoid running the ARM parser multiple times because StringSwitch is not lazy. Reviewers: Renato Golin, Tim Northover Differential Revision: http://reviews.llvm.org/D7166 llvm-svn: 227085
* [ADT] Add move operations to SmallVector<T,N> from SmallVectorImpl<T>.Lang Hames2015-01-231-6/+75
| | | | | | | | This makes it possible to move between SmallVectors of different sizes. Thanks to Dave Blaikie and Duncan Smith for patch feedback. llvm-svn: 226899
* [tinyptrvector] Add in a MutableArrayRef implicit conversion operator to ↵Michael Gottesman2015-01-191-0/+21
| | | | | | complement the ArrayRef implicit conversion operator. llvm-svn: 226428
* Disable -Wunknown-pragmas in a test so that Clang without -Wself-move will notRichard Trieu2015-01-141-0/+4
| | | | | | complain that the flag doesn't exist. llvm-svn: 225931
* Silence warnings about unknown pragmas for compilers that are not Clang. NFC.Aaron Ballman2015-01-131-1/+4
| | | | llvm-svn: 225788
* Disable a warning for self move since the test is checking for this behavior.Richard Trieu2015-01-131-0/+4
| | | | llvm-svn: 225754
* [APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.Lang Hames2015-01-041-0/+41
| | | | | | | | | | | | | | This patch adds a check for underflow when truncating results back to lower precision at the end of an FMA. The additional sign handling logic in APFloat::fusedMultiplyAdd should only be performed when the result of the addition step of the FMA (in full precision) is exactly zero, not when the result underflows to zero. Unit tests for this case and related signed zero FMA results are included. Fixes <rdar://problem/18925551>. llvm-svn: 225123
* Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ↵Chandler Carruth2015-01-011-35/+0
| | | | | | | | | | | ArrayRef<T*> where T is a base of U. This appears to have broken at least the windows build bots due to compile errors in the predicate that didn't simply supress the overload. I'm not sure what the fix is, and the bots have been broken for a long time now so I'm just reverting until Michael can figure out a fix. llvm-svn: 225064
* Add 2x constructors for TinyPtrVector, one that takes in one elemenet and ↵Michael Gottesman2014-12-311-0/+26
| | | | | | | | | the other that takes in an ArrayRef<EltTy> Currently one can only construct an empty TinyPtrVector. These are just missing elements of the API. llvm-svn: 225055
* Add a SmallMapVector class that is a MapVector with a Map of SmallDenseMap ↵Michael Gottesman2014-12-311-0/+218
| | | | | | and a Vector of SmallVector. llvm-svn: 225054
* Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> ↵Michael Gottesman2014-12-311-0/+35
| | | | | | where T is a base of U. llvm-svn: 225053
* Silencing several "multiple copy constructors" warnings from MSVC; NFC.Aaron Ballman2014-12-031-1/+0
| | | | llvm-svn: 223238
* ADT: Add SmallVector<>::emplace_back()Duncan P. N. Exon Smith2014-12-031-0/+131
| | | | llvm-svn: 223201
* Compilation test for PostOrderIterator.Michael Ilseman2014-11-202-0/+38
| | | | | | | | | If the template specialization for externally managed sets in PostOrderIterator call too far out of sync with each other, this unit test will fail to build. This is especially useful for developers who may not build Clang (the only in-tree user) every time. llvm-svn: 222447
* [ADT] Fix PR20728 - Incorrect APFloat::fusedMultiplyAdd results for x86_fp80.Lang Hames2014-11-191-0/+12
| | | | | | | | | | | | | | As detailed at http://llvm.org/PR20728, due to an internal overflow in APFloat::multiplySignificand the APFloat::fusedMultiplyAdd method can return incorrect results for x87DoubleExtended (x86_fp80) values. This commonly manifests as incorrect constant folding of libm fmal calls on x86. E.g. fmal(1.0L, 1.0L, 3.0L) == 0.0L (should be 4.0L) This patch fixes PR20728 by adding an extra bit to the significand for intermediate results of APFloat::multiplySignificand, avoiding the overflow. llvm-svn: 222374
* Remove StringMap::GetOrCreateValue in favor of StringMap::insertDavid Blaikie2014-11-191-6/+4
| | | | | | | | | | | | | | Having two ways to do this doesn't seem terribly helpful and consistently using the insert version (which we already has) seems like it'll make the code easier to understand to anyone working with standard data structures. (I also updated many references to the Entry's key and value to use first() and second instead of getKey{Data,Length,} and get/setValue - for similar consistency) Also removes the GetOrCreateValue functions so there's less surface area to StringMap to fix/improve/change/accommodate move semantics, etc. llvm-svn: 222319
* StringMap: Test and finish off supporting perfectly forwarded values in ↵David Blaikie2014-11-141-1/+15
| | | | | | | | StringMap operations. Followup to r221946. llvm-svn: 221958
* Ensure function_refs are copyable even from non-const referencesDavid Blaikie2014-11-122-0/+29
| | | | | | | | | | | | | | | | | | A subtle bug was found where attempting to copy a non-const function_ref lvalue would actually invoke the generic forwarding constructor (as it was a closer match - being T& rather than the const T& of the implicit copy constructor). In the particular case this lead to a dangling function_ref member (since it had referenced the function_ref passed by value to its ctor, rather than the outer function_ref that was still alive) SFINAE the converting constructor to not be considered if the copy constructor is available and demonstrate that this causes the copy to refer to the original functor, not to the function_ref it was copied from. (without the code change, the test would fail as Y would be referencing X and Y() would see the result of the mutation to X, ie: 2) llvm-svn: 221753
* Add MapVector::rbegin(), MapVector::rend() to completment ↵Michael Gottesman2014-10-271-0/+25
| | | | | | | | | | MapVector::begin(), MapVector::end(). These just delegate to the underlying vector type in the MapVector. Also just add in some sanity unittests. llvm-svn: 220687
* [ADT] Add a 'find_as' operation to DenseSet.Lang Hames2014-10-191-0/+38
| | | | | | | | | | This operation is analogous to its counterpart in DenseMap: It allows lookup via cheap-to-construct keys (provided that getHashValue and isEqual are implemented for the cheap key-type in the DenseMapInfo specialization). Thanks to Chandler for the review. llvm-svn: 220168
* [ADT] Add an (ADL-friendly) abs free function for APFloat that returnsChandler Carruth2014-10-101-0/+38
| | | | | | by value having cleared the sign bit. llvm-svn: 219485
* Add minnum / maxnum to APFloatMatt Arsenault2014-10-101-0/+22
| | | | llvm-svn: 219475
* [ADT] Replace the logb implementation with the simpler and much closerChandler Carruth2014-10-101-49/+27
| | | | | | | | to what we actually want ilogb implementation. This makes everything *much* easier to deal with and is actually what we want when using it anyways. llvm-svn: 219474
* [ADT] Add the scalbn function for APFloat.Chandler Carruth2014-10-101-0/+43
| | | | llvm-svn: 219473
* [ADT] Implement the 'logb' functionality for APFloat. This is necessaryChandler Carruth2014-10-101-0/+51
| | | | | | to implement complex division in the constant folder of Clang. llvm-svn: 219471
OpenPOWER on IntegriCloud