summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert rL317019, "[ADT] Split optional to only include copy mechanics and ↵NAKAMURA Takumi2017-11-011-9/+0
| | | | | | | | dtor for non-trivial types." Seems g++-4.8 (eg. Ubuntu 14.04) doesn't like this. llvm-svn: 317077
* [ADT] Split optional to only include copy mechanics and dtor for non-trivial ↵Benjamin Kramer2017-10-311-0/+9
| | | | | | | | | types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. llvm-svn: 317019
* Add a new Simulator entry for the target triple environment.Bob Wilson2017-10-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Apple's iOS, tvOS and watchOS simulator platforms have never been clearly distinguished in the target triples. Even though they are intended to behave similarly to the corresponding device platforms, they have separate SDKs and are really separate platforms from the compiler's perspective. Clang now defines a macro when building for one of these simulator platforms (r297866) but that relies on the very indirect mechanism of checking to see which option was used to specify the minimum deployment target. That is not so great. Swift would also like to distinguish these simulator platforms in a similar way, but unlike Clang, Swift does not use a separate option to specify the minimum deployment target -- it uses a -target option to specify the target triple directly, including the OS version number. Using a different target triple for the simulator platforms is a much more direct and obvious way to specify this. Putting the "simulator" in the environment component of the triple means the OS values can stay the same and existing code the looks at the OS field will not be affected. https://reviews.llvm.org/D39143 rdar://problem/34729432 llvm-svn: 316380
* Revert rL316156 due to failure on APFloatTest.fromToStringSpecialsMax Kazantsev2017-10-191-16/+0
| | | | llvm-svn: 316158
* Fix APFloat from string conversion for InfSerguei Katkov2017-10-191-0/+16
| | | | | | | | | | | | | | | | The method IEEEFloat::convertFromStringSpecials() does not recognize the "+Inf" and "-Inf" strings but these strings are printed for the double Infinities by the IEEEFloat::toString(). This patch adds the "+Inf" and "-Inf" strings to the list of recognized patterns in IEEEFloat::convertFromStringSpecials(). Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon Reviewed By: skatkov Subscribers: apilipenko, reames, llvm-commits Differential Revision: https://reviews.llvm.org/D38030 llvm-svn: 316156
* Untabify.NAKAMURA Takumi2017-10-181-2/+2
| | | | llvm-svn: 316079
* Revert "[ADT] Make Twine's copy constructor private."Zachary Turner2017-10-111-8/+0
| | | | | | | | | | This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5. This is failing due to some code that isn't built on MSVC so I didn't catch. Not immediately obvious how to fix this at first glance, so I'm reverting for now. llvm-svn: 315536
* [ADT] Make Twine's copy constructor private.Zachary Turner2017-10-111-0/+8
| | | | | | | | | | | | | | | | | There's a lot of misuse of Twine scattered around LLVM. This ranges in severity from benign (returning a Twine from a function by value that is just a string literal) to pretty sketchy (storing a Twine by value in a class). While there are some uses for copying Twines, most of the very compelling ones are confined to the Twine class implementation itself, and other uses are either dubious or easily worked around. This patch makes Twine's copy constructor private, and fixes up all callsites. Differential Revision: https://reviews.llvm.org/D38767 llvm-svn: 315530
* [Triple] Add AMDPAL operating system typeTim Renouf2017-09-291-0/+6
| | | | | | | | | | | | | | | | | | Summary: This operating system type represents the AMDGPU PAL runtime, and will be required by the AMDGPU backend in order to generate correct code for this runtime. Currently it generates the same code as not specifying an OS at all. That will change in future commits. Patch from Tim Corringham. Subscribers: arsenm, nhaehnle Differential Revision: https://reviews.llvm.org/D37380 llvm-svn: 314500
* [mips] Recognise the triple used by Debian for MIPS n32 ABISimon Atanasyan2017-09-141-0/+6
| | | | | | | Triples like mips64-linux-gnuabin32 are documented in this article: https://wiki.debian.org/Multiarch/Tuples llvm-svn: 313231
* [mips] Add unitests to check parsing MIPS triples. NFCSimon Atanasyan2017-09-131-0/+30
| | | | llvm-svn: 313160
* Untabify.NAKAMURA Takumi2017-08-281-1/+1
| | | | llvm-svn: 311875
* [ADT] Enable reverse iteration for DenseMapMandeep Singh Grang2017-08-242-53/+0
| | | | | | | | | | | | Reviewers: mehdi_amini, dexonsmith, dblaikie, davide, chandlerc, davidxl, echristo, efriedma Reviewed By: dblaikie Subscribers: rsmith, mgorny, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35043 llvm-svn: 311730
* [APFloat] Fix IsInteger() for DoubleAPFloat.Davide Italiano2017-08-211-0/+18
| | | | | | | | Previously, we would just assert instead. Differential Revision: https://reviews.llvm.org/D36961 llvm-svn: 311351
* [Triple] Define OS Check for HaikuRenato Golin2017-08-181-0/+12
| | | | | | | | | | | | | This adds the OS check for the Haiku operating system, as it was missing in the Triple class. Tests for x86_64-unknown-haiku and i586-pc-haiku were also added. These patches only affect Haiku and are completely harmless for other platforms. Patch by Calvin Hill <calvin@hakobaito.co.uk> llvm-svn: 311153
* [ADT] Fix another "oops" spotted by eddyb and reported in IRC.Chandler Carruth2017-07-101-1/+1
| | | | | | This test pretty clearly should be calling 'maxnum' here. =] llvm-svn: 307519
* [ADT] Fix a test case to use a correct escape for a null byte followedChandler Carruth2017-07-091-7/+7
| | | | | | | | | | by a valid octal digit. The length argument shows that this was in fact the intent. This was pointed out in IRC, thanks to eddyb! llvm-svn: 307496
* [ADT] Add a default constructor and a bool conversion to function_ref.Chandler Carruth2017-07-091-0/+14
| | | | | | | | | | The internal representation has a natural way to handle this and it seems nicer than having to wrap this in an optional (with its own separate flag). This also matches how std::function works. llvm-svn: 307490
* Add support for Ananas platformEd Schouten2017-06-251-0/+6
| | | | | | | | | | | | | | | | | Ananas is a home-brew operating system, mainly for amd64 machines. After using GCC for quite some time, it has switched to clang and never looked back - yet, having to manually patch things is annoying, so it'd be much nicer if this was in the official tree. More information: https://github.com/zhmu/ananas/ https://rink.nu/projects/ananas.html Submitted by: Rink Springer Differential Revision: https://reviews.llvm.org/D32937 llvm-svn: 306237
* Fix double->float truncation warning on MSVCSimon Pilgrim2017-06-231-2/+2
| | | | llvm-svn: 306101
* [ADT] Add llvm::to_floatPavel Labath2017-06-231-1/+19
| | | | | | | | | | | | | | | | | | Summary: The function matches the interface of llvm::to_integer, but as we are calling out to a C library function, I let it take a Twine argument, so we can avoid a string copy at least in some cases. I add a test and replace a couple of existing uses of strtod with this function. Reviewers: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34518 llvm-svn: 306096
* Revert r305642Ismail Donmez2017-06-181-1/+1
| | | | llvm-svn: 305643
* Test to correct triple for SUSE on ARMv7Ismail Donmez2017-06-181-1/+1
| | | | llvm-svn: 305642
* Added braces to work around gcc warning in googletest: suggest explicit ↵Galina Kistanova2017-06-152-3/+6
| | | | | | braces to avoid ambiguous 'else'. NFC. llvm-svn: 305506
* [ADT] Don't use __used__ attribute on struct members in unit testFrancis Ricci2017-06-121-10/+10
| | | | | | | On some compilers, __used__ can only be applied to variables or functions. llvm-svn: 305188
* [ADT] Use LLVM_ATTRIBUTE_USED instead of __attribute__ for unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305168
* [ADT] Suppress unused attribute warning in unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305166
* [SmallVector] Reinstate the typedefs.Davide Italiano2017-06-101-0/+3
| | | | | | | | | They're unused with recent versions of libstdc++ but older ones (e.g. libstdc++ 4.9 still requires them). Maybe we should bump the requirements on the minimum version to make GCC 7 happy, but in the meanwhile we need to live with the warning. llvm-svn: 305158
* [SmallVector] Remove unused typedefs, spotted by GCC 7. NFCI.Davide Italiano2017-06-101-3/+0
| | | | llvm-svn: 305157
* [ADT] Make iterable SmallVector template overrides more specificFrancis Ricci2017-06-091-0/+61
| | | | | | | | | | | | | | | | Summary: This prevents the iterator overrides from being selected in the case where non-iterator types are used as arguments, which is of particular importance in cases where other overrides with identical types exist. Reviewers: dblaikie, bkramer, rafael Subscribers: llvm-commits, efriedma Differential Revision: https://reviews.llvm.org/D33919 llvm-svn: 305105
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-0624-26/+26
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* ADT: handle special case of ARM environment for SUSESaleem Abdulrasool2017-06-031-0/+5
| | | | | | | SUSE treats "gnueabi" as "gnueabihf" so make sure that we normalise the environment. llvm-svn: 304670
* Tidy up a bit of r304516, use SmallVector::assign rather than for loopDavid Blaikie2017-06-021-0/+10
| | | | | | | | | | | | | | | | This might give a few better opportunities to optimize these to memcpy rather than loops - also a few minor cleanups (StringRef-izing, templating (to avoid std::function indirection), etc). The SmallVector::assign(iter, iter) could be improved with the use of SFINAE, but the (iter, iter) ctor and append(iter, iter) need it to and don't have it - so, workaround it for now rather than bothering with the added complexity. (also, as noted in the added FIXME, these assign ops could potentially be optimized better at least for non-trivially-copyable types) llvm-svn: 304566
* Avoid a UB pointer overflow in the ArrayRef unit testVedant Kumar2017-05-311-15/+15
| | | | | | | | | | | | The intent of the test is to check that array lengths greater than UINT_MAX work properly. Change the test to stress that scenario, without triggering pointer overflow UB. Caught by a WIP pointer overflow checker in clang. Differential Revision: https://reviews.llvm.org/D33149 llvm-svn: 304353
* [APInt] Add support for dividing or remainder by a uint64_t or int64_t.Craig Topper2017-05-191-0/+58
| | | | | | | | | | | | | | | | | | | Summary: This patch adds udiv/sdiv/urem/srem/udivrem/sdivrem methods that can divide by a uint64_t. This makes division consistent with all the other arithmetic operations. This modifies the interface of the divide helper method to work on raw arrays instead of APInts. This way we can pass the uint64_t in for the RHS without wrapping it in an APInt. This required moving all the Quotient and Remainder allocation handling up to the callers. For udiv/urem this was as simple as just creating the Quotient/Remainder with the right size when they were declared. For udivrem we have to rely on reallocate not changing the contents of the variable LHS or RHS is aliased with the Quotient or Remainder APInts. We also have to zero the upper bits of Remainder and Quotient that divide doesn't write to if lhsWords/rhsWords is smaller than the width. I've update the toString method to use the new udivrem. Reviewers: hans, dblaikie, RKSimon Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33310 llvm-svn: 303431
* [BitVector] Add find_[first,last]_[set,unset]_in.Zachary Turner2017-05-171-4/+151
| | | | | | | | | | | | | A lot of code is duplicated between the first_last and the next / prev methods. All of this code can be shared if they are implemented in terms of find_first_in(Begin, End) etc, in which case find_first = find_first_in(0, Size) and find_next is find_first_in(Prev+1, Size), with similar reductions for the other methods. Differential Revision: https://reviews.llvm.org/D33104 llvm-svn: 303269
* BitVector: add iterators for set bitsFrancis Visoiu Mistrih2017-05-171-0/+29
| | | | | | Differential revision: https://reviews.llvm.org/D32060 llvm-svn: 303227
* [APInt] Add support for multiplying by a uint64_t.Craig Topper2017-05-081-0/+19
| | | | | | This makes multiply similar to add, sub, xor, and, and or. llvm-svn: 302402
* [ADT] Add BitVector::find_prev.Zachary Turner2017-05-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | This almost completes the matrix of all possible find functions. *EXISTING* ---------- find_first find_first_unset find_next find_next_unset find_last find_last_unset *NEW* ---- find_prev *STILL MISSING* --------------- find_prev_unset Differential Revision: https://reviews.llvm.org/D32885 llvm-svn: 302254
* [ADT] A few minor improvements to BitVectorZachary Turner2017-05-051-0/+19
| | | | | | | Fixes some spelling mistakes, uses a helper function, and adds an additional test case. llvm-svn: 302208
* [APInt] Remove support for wrapping from APInt::setBits.Craig Topper2017-04-301-15/+15
| | | | | | | | This features isn't used anywhere in tree. It's existence seems to be preventing selfhost builds from inlining any of the setBits methods including setLowBits, setHighBits, and setBitsFrom. This is because the code makes the method recursive. If anyone needs this feature in the future we could consider adding a setBitsWithWrap method. This way only the calls that need it would pay for it. llvm-svn: 301769
* [StringExtras] Add a fromHex to complement toHex.Zachary Turner2017-04-251-0/+16
| | | | | | | | | | We already have a function toHex that will convert a string like "\xFF\xFF" to the string "FFFF", but we do not have one that goes the other way - i.e. to convert a textual string representing a sequence of hexadecimal characters into the corresponding actual bytes. This patch adds such a function. llvm-svn: 301356
* [APInt] Add ashrInPlace method and rewrite ashr to make a copy and then call ↵Craig Topper2017-04-241-0/+36
| | | | | | | | | | | | ashrInPlace. This patch adds an in place version of ashr to match lshr and shl which were recently added. I've tried to make this similar to the lshr code with additions to handle the sign extension. I've also tried to do this with less if checks than the current ashr code by sign extending the original result to a word boundary before doing any of the shifting. This removes a lot of the complexity of determining where to fill in sign bits after the shifting. Differential Revision: https://reviews.llvm.org/D32415 llvm-svn: 301198
* Add SUSE vendorIsmail Donmez2017-04-241-0/+6
| | | | | | | | | | | | | | Summary: SUSE's ARM triples end with -gnueabi even though they are hard-float. This requires special handling of SUSE ARM triples. Hence we need a way to differentiate the SUSE as vendor. This CL adds that. Reviewers: chandlerc, compnerd, echristo, rengolin Reviewed By: rengolin Subscribers: aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D32426 llvm-svn: 301174
* [APInt] Make behavior of ashr by BitWidth consistent between single and ↵Craig Topper2017-04-241-1/+1
| | | | | | | | multi word. Previously single word would always return 0 regardless of the original sign. Multi word would return all 0s or all 1s based on the original sign. Now single word takes into account the sign as well. llvm-svn: 301159
* [APInt] In sext single word case, use SignExtend64 and let the APInt ↵Craig Topper2017-04-231-0/+20
| | | | | | | | constructor mask off any excess bits. The current code is trying to be clever with shifts to avoid needing to clear unused bits. But it looks like the compiler is unable to optimize out the unused bit handling in the APInt constructor. Given this its better to just use SignExtend64 and have more readable code. llvm-svn: 301133
* Revert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix ↵Renato Golin2017-04-231-19/+1
| | | | | | | | | | a bug in the shift by BitWidth handling." This reverts commit r301094, as it broke all ARM self-hosting bots. PR32754. llvm-svn: 301110
* [APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug ↵Craig Topper2017-04-221-1/+19
| | | | | | | | in the shift by BitWidth handling. For single word, shift by BitWidth was always returning 0, but for multiword it was based on original sign. Now single word matches multi word. llvm-svn: 301094
* [BitVector] Add find_last() and find_last_unset().Zachary Turner2017-04-211-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D32302 llvm-svn: 301014
* [AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent ↵Serguei Katkov2017-04-211-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | snprinf This should fix the bug https://bugs.llvm.org/show_bug.cgi?id=12906 To print the FP constant AsmWriter does the following: 1) convert FP value to String (actually using snprintf function which is locale dependent). 2) Convert String back to FP Value 3) Compare original and got FP values. If they are not equal just dump as hex. The problem happens on the 2nd step when APFloat does not expect group delimiter or fraction delimiter other than period symbol and so on, which can be produced on the first step if LLVM library is used in an environment with corresponding locale set. To fix this issue the locale independent APFloat:toString function is used. However it prints FP values slightly differently than snprintf does. Specifically it suppress trailing zeros in significant, use capital E and so on. It results in 117 test failures during make check. To avoid this I've also updated APFloat.toString a bit to pass make check at least. Reviewers: sberg, bogner, majnemer, sanjoy, timshen, rnk Reviewed By: timshen, rnk Subscribers: rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D32276 llvm-svn: 300943
OpenPOWER on IntegriCloud