summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* Test the polymorphic behavior of this utility.Chandler Carruth2013-11-091-1/+33
| | | | llvm-svn: 194320
* Use something really explicit to test "move semantics" on builds withoutChandler Carruth2013-11-091-0/+4
| | | | | | | | | r-value references. I still want to test that when we have them, llvm_move is actually a move. Have I mentioned that I really want to move to C++11? ;] llvm-svn: 194318
* Add the critically missing 'clone' method. =]Chandler Carruth2013-11-091-0/+11
| | | | | | | | | | Clang managed to never instantiate the copy constructor. Added tests to ensure this path is tested. We could still use tests for the polymorphic nature. Those coming up next. llvm-svn: 194317
* Move the test type out of the function and into the anonymous namespaceChandler Carruth2013-11-091-5/+5
| | | | | | to fix C++98 builds. llvm-svn: 194316
* Add a polymorphic_ptr<T> smart pointer data type. It's a somewhat sillyChandler Carruth2013-11-092-0/+72
| | | | | | | | | | | | unique ownership smart pointer which is *deep* copyable by assuming it can call a T::clone() method to allocate a copy of the owned data. This is mostly useful with containers or other collections of uniquely owned data in C++98 where they *might* copy. With C++11 we can likely remove this in favor of move-only types and containers wrapped around those types. llvm-svn: 194315
* Add {start,end}with_lower methods to StringRef.Rui Ueyama2013-10-301-0/+23
| | | | | | | | | startswith_lower is ocassionally useful and I think worth adding. endwith_lower is added for completeness. Differential Revision: http://llvm-reviews.chandlerc.com/D2041 llvm-svn: 193706
* Add a few tests for StringRef::{start,end}with.Rui Ueyama2013-10-281-0/+2
| | | | llvm-svn: 193550
* Add a Python-like join function to merge a list of strings with aJoerg Sonnenberger2013-09-031-0/+27
| | | | | | separator between each two elements. llvm-svn: 189846
* Change default # of digits for APFloat::toStringEli Friedman2013-08-291-4/+5
| | | | | | | | | | | | | | | | | This is a re-commit of r189442; I'll follow up with clang changes. The previous default was almost, but not quite enough digits to represent a floating-point value in a manner which preserves the representation when it's read back in. The larger default is much less confusing. I spent some time looking into printing exactly the right number of digits if a precision isn't specified, but it's kind of complicated, and I'm not really sure I understand what APFloat::toString is supposed to output for FormatPrecision != 0 (or maybe the current API specification is just silly, not sure which). I have a WIP patch if anyone is interested. llvm-svn: 189624
* Revert r189442 "Change default # of digits for APFloat::toString"Ted Kremenek2013-08-281-5/+4
| | | | | | This is breaking numerous Clang tests on the buildbot. llvm-svn: 189447
* Change default # of digits for APFloat::toStringEli Friedman2013-08-281-4/+5
| | | | | | | | | | | | | | | The previous default was almost, but not quite enough digits to represent a floating-point value in a manner which preserves the representation when it's read back in. The larger default is much less confusing. I spent some time looking into printing exactly the right number of digits if a precision isn't specified, but it's kind of complicated, and I'm not really sure I understand what APFloat::toString is supposed to output for FormatPrecision != 0 (or maybe the current API specification is just silly, not sure which). I have a WIP patch if anyone is interested. llvm-svn: 189442
* Basic unit tests for PointerUnionDavid Blaikie2013-08-212-0/+65
| | | | llvm-svn: 188933
* [APFloat] Make all arithmetic operations with NaN produce positive NaNs.Michael Gottesman2013-07-271-86/+36
| | | | | | | | | | | | | IEEE-754R 1.4 Exclusions states that IEEE-754R does not specify the interpretation of the sign of NaNs. In order to remove an irrelevant variable that most floating point implementations do not use, standardize add, sub, mul, div, mod so that operating anything with NaN always yields a positive NaN. In a later commit I am going to update the APIs for creating NaNs so that one can not even create a negative NaN. llvm-svn: 187314
* Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."Rafael Espindola2013-07-262-2/+2
| | | | | | This reverts commit r187248. It broke many bots. llvm-svn: 187254
* [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.Bill Schmidt2013-07-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for all PowerPC targets, whether 32- or 64-bit. They will both implicitly define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not for 32-bit targets. We cannot be sure that all other possible compilers used to compile Clang/LLVM define both __ppc__ and __powerpc__, for example, so it is best to check for both when relying on either inside the Clang/LLVM code base. This patch makes sure we always check for both variants. In addition, it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp. (At least one of __ppc__ and __powerpc__ should always be defined when compiling for a PowerPC target, no matter which compiler is used, so testing for them is unnecessary.) There are some places in the compiler that check for other variants, like __POWERPC__ and _POWER, and I have left those in place. There is no need to add them elsewhere. This seems to be in Apple-specific code, and I won't take a chance on breaking it. There is no intended change in behavior; thus, no test cases are added. llvm-svn: 187248
* Handle '.' correctly in hex float literal parsing.Eli Friedman2013-07-171-1/+6
| | | | | | | | | | | There were a couple of different loops that were not handling '.' correctly in APFloat::convertFromHexadecimalString; these mistakes could lead to assertion failures and incorrect rounding for overlong hex float literals. Fixes PR16643. llvm-svn: 186539
* Sync SmallBitVector with BitVector. Add unit tests for the missing methods.Benjamin Kramer2013-07-111-0/+36
| | | | llvm-svn: 186123
* [APFloat] Ensure that we can properly parse strings that do not have null ↵Michael Gottesman2013-07-011-0/+25
| | | | | | | | terminators. rdar://14323230 llvm-svn: 185397
* [APFloat] Added unittest for APFloat.divide that checks special cases, ↵Michael Gottesman2013-06-271-0/+304
| | | | | | result categories, and result statuses. llvm-svn: 185050
* Removed two logging printf statements from the APFloat tests... = /.Michael Gottesman2013-06-271-8/+0
| | | | llvm-svn: 185045
* [APFloat] Added unittest for APFloat.multiply that checks special cases, ↵Michael Gottesman2013-06-261-0/+307
| | | | | | result categories, and result status. llvm-svn: 185044
* [APFloat] Added unittest for APFloat.subtract that checks special cases, ↵Michael Gottesman2013-06-261-0/+303
| | | | | | result categories, and result status. llvm-svn: 185043
* [APFloat] Removed debugging cruft that snuck in.Michael Gottesman2013-06-261-4/+0
| | | | llvm-svn: 184974
* [APFloat] Removed trailing whitespace from unittests.Michael Gottesman2013-06-241-14/+14
| | | | llvm-svn: 184715
* [APFloat] Added a large unittest for APFloat.add that checks that special ↵Michael Gottesman2013-06-241-0/+302
| | | | | | values are computed correctly. llvm-svn: 184714
* [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.Michael Gottesman2013-06-201-7/+7
| | | | | | | | The old isNormal is already functionally replaced by the method isFiniteNonZero in r184350 and all references to said method were replaced in LLVM/clang in r184356/134366. llvm-svn: 184449
* [APFloat] Fix typo in test so we actually test if we handle denormals.Michael Gottesman2013-06-201-4/+4
| | | | llvm-svn: 184447
* [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all ↵Michael Gottesman2013-06-191-8/+8
| | | | | | | | tests in unittests. I forgot to to do this in r184356. The only references were in APFloatTest.cpp. llvm-svn: 184366
* [APFloat] Added isFiniteNonZero predicate.Michael Gottesman2013-06-191-0/+28
| | | | | | | | | | | | | | | | | This is the first patch in a series of patches to rename isNormal => isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless errors on my part the overall plan is: 1. Add the isFiniteNonZero predicate with tests. I can do this in a method independent of isNormal. (This step is this patch). 2. Convert all references to isNormal with isFiniteNonZero. My plan is to comment out isNormal locally and continually convert isNormal references => isFiniteNonZero until llvm/clang compiles. 3. Remove old isNormal and rename isIEEENormal to isNormal. 4. Look through all of said references from patch 2 and see if we can simplify them by using the new isNormal. llvm-svn: 184350
* BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.Benjamin Kramer2013-06-071-0/+16
| | | | llvm-svn: 183525
* Optimize BitVector::all().Benjamin Kramer2013-06-071-0/+8
| | | | llvm-svn: 183521
* IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).Michael Gottesman2013-06-041-0/+61
| | | | | | | | | | | | | | | Specifically the following work was done: 1. If the operation was not implemented, I implemented it. 2. If the operation was already implemented, I just moved its location in the APFloat header into the IEEE-754R 5.7.2 section. If the name was incorrect, I put in a comment giving the true IEEE-754R name. Also unittests have been added for all of the functions which did not already have a unittest. llvm-svn: 183179
* Try to avoid "integer literal too big" warnings from older GCCs.Benjamin Kramer2013-06-011-7/+7
| | | | llvm-svn: 183081
* [APFloat] Added a unittest for APFloat::getZero.Michael Gottesman2013-05-311-0/+37
| | | | llvm-svn: 183028
* Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the ↵Michael Gottesman2013-05-301-0/+420
| | | | | | | | function APFloat::next(bool nextDown). rdar://13852078 llvm-svn: 182945
* Added a unittest for APFloat::getSmallestNormalized.Michael Gottesman2013-05-301-0/+30
| | | | llvm-svn: 182897
* Added code to the unittest for APFloat::getSmallest to double check that we ↵Michael Gottesman2013-05-301-2/+6
| | | | | | | | | consider the result to be denormal. I additionally changed certain checks to use EXPECT_FALSE instead of a boolean complement with EXPECT_TRUE. llvm-svn: 182896
* Add a unittest for APFloat::getSmallest.Michael Gottesman2013-05-291-0/+26
| | | | llvm-svn: 182894
* [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for ↵Michael Gottesman2013-05-281-0/+65
| | | | | | | | use in APFloat IEEE-754R 2008 nextUp/nextDown function. rdar://13852078 llvm-svn: 182801
* Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * ↵Shuxin Yang2013-05-131-0/+23
| | | | | | -14.5f + 225.0f" to 225.0f. llvm-svn: 181715
* SmallVector and SmallPtrSet allocations now power-of-two aligned.Jean-Luc Duprat2013-03-291-0/+55
| | | | | | This time tested on both OSX and Linux. llvm-svn: 178377
* Revert "Fix allocations of SmallVector and SmallPtrSet so they are more ↵Rafael Espindola2013-03-291-55/+0
| | | | | | | | | | | | | | | | | prone to" This reverts commit 617330909f0c26a3f2ab8601a029b9bdca48aa61. It broke the bots: /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure Value of: v[i].getValue() Actual: 0 Expected: value Which is: 2 llvm-svn: 178334
* Fix allocations of SmallVector and SmallPtrSet so they are more prone toJean-Luc Duprat2013-03-291-0/+55
| | | | | | being power-of-two sized. llvm-svn: 178332
* Only include move-related Optional<T> tests when rvalue references are ↵David Blaikie2013-02-211-30/+32
| | | | | | available. llvm-svn: 175730
* Add move ctor/assignment to Optional<T>David Blaikie2013-02-211-0/+109
| | | | | | Code review feedback for r175580 by Jordan Rose. llvm-svn: 175729
* Move the SplatByte helper to APInt and generalize it a bit.Benjamin Kramer2013-02-201-0/+10
| | | | llvm-svn: 175621
* Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.David Blaikie2013-02-201-1/+1
| | | | | | Code review feedback on r175580 from Jordan Rose. llvm-svn: 175595
* Allow llvm::Optional to work with types without default constructors.David Blaikie2013-02-202-0/+174
| | | | | | | | | This generalizes Optional to require less from the T type by using aligned storage for backing & placement new/deleting the T into it when necessary. Also includes unit tests. llvm-svn: 175580
* Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a ↵Douglas Gregor2013-02-191-1/+15
| | | | | | unit test. llvm-svn: 175538
* ADT: Correct APInt::getActiveWords for zero valuesMeador Inge2013-02-071-0/+8
| | | | | | | | | | PR15138 was opened because of a segfault in the Bitcode writer. The actual issue ended up being a bug in APInt where calls to APInt::getActiveWords returns a bogus value when the APInt value is 0. This patch fixes the problem by ensuring that getActiveWords returns 1 for 0 valued APInts. llvm-svn: 174641
OpenPOWER on IntegriCloud