summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
* Revert r326723: Make STATISTIC() values available programmaticallyDaniel Sanders2018-03-052-107/+0
| | | | | | Despite building cleanly on my machine in three separate configs, it's failing on pretty much all bots due to missing includes among other things. Investigating. llvm-svn: 326726
* Make STATISTIC() values available programmaticallyDaniel Sanders2018-03-052-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It can be useful for tools to be able to retrieve the values of variables declared via STATISTIC() directly without having to emit them and parse them back. Use cases include: * Needing to report specific statistics to a test harness * Wanting to post-process statistics. For example, to produce a percentage of functions that were fully selected by GlobalISel Make this possible by adding llvm::GetStatistics() which returns an iterator_range that can be used to inspect the statistics that have been touched during execution. When statistics are disabled (NDEBUG and not LLVM_ENABLE_STATISTICS) this method will return an empty range. This patch doesn't address the effect of multiple compilations within the same process. In such situations, the statistics will be cumulative for all compilations up to the GetStatistics() call. Reviewers: qcolombet, rtereshin, aditya_nandakumar, bogner Reviewed By: rtereshin, bogner Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D43901 llvm-svn: 326723
* [ADT] Recognize ppc as valid architecture in target triple.Jonas Devlieghere2018-02-271-0/+17
| | | | | | | | | | | | | | | | Until this patch, only `powerpc` and `ppc32` were recognized as valid PowerPC 32-bit architectures in a target triple. This was incompatible with the triple `ppc-apple-darwin` as returned for libObject. I found out about this when working on a test case using a binary generated on an old PowerBook G4. We had the choice of either fix this in the Mach-O object parser or in the Triple implementation. I chose the latter because it feels like the most canonical place. Differential revision: https://reviews.llvm.org/D43760 llvm-svn: 326182
* [ADT] Simplify and optimize StringSwitchDavid Zarzycki2018-02-261-2/+4
| | | | | | | | This change improves incremental rebuild performance on dual Xeon 8168 machines by 54%. This change also improves run time code gen by not forcing the case values to be lvalues. llvm-svn: 326109
* [APInt] Fix extractBits to correctly handle Result.isSingleWord() case.Tim Shen2018-02-161-0/+7
| | | | | | | | | | | | Summary: extractBits assumes that `!this->isSingleWord() implies !Result.isSingleWord()`, which may not necessarily be true. Handle both cases. Reviewers: RKSimon Subscribers: sanjoy, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D43363 llvm-svn: 325311
* [WebAssembly] Restore "*-wasm" tests.Dan Gohman2018-02-151-0/+5
| | | | | | | Even though "...-wasm" is now the default for wasm, it's still desirable to test this form. llvm-svn: 325273
* [WebAssembly] Update ADT/TripleTest.cpp now that default file format has changedSam Clegg2018-02-121-2/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D43212 llvm-svn: 324966
* Fix incorrect usage of std::is_assignable.Richard Smith2018-02-022-10/+10
| | | | | | We want to check that we can assign to an lvalue here, not a prvalue. llvm-svn: 324152
* [ADT] Make moving Optional not reset the Optional it moves from.Benjamin Kramer2018-01-251-6/+6
| | | | | | | | | This brings it in line with std::optional. My recent changes to make Optional of trivial types trivially copyable introduced diverging behavior depending on the type, which is bad. Now all types have the same moving behavior. llvm-svn: 323445
* Give scope_exit helper correct move semanticsSam McCall2018-01-251-0/+17
| | | | llvm-svn: 323442
* Fix typos of occurred and occurrenceMalcolm Parsons2018-01-242-6/+6
| | | | llvm-svn: 323318
* [ADT] Just give up on GCC, I can't fix this.Benjamin Kramer2018-01-181-2/+1
| | | | | | | | | | While the memmove workaround fixed it for GCC 6.3. GCC 4.8 and GCC 7.1 are still broken. I have no clue what's going on, just blacklist GCC for now. Needless to say this code is ubsan, asan and msan-clean. llvm-svn: 322862
* [ADT] Split optional to only include copy mechanics and dtor for non-trivial ↵Benjamin Kramer2018-01-181-0/+9
| | | | | | | | | | | | | types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. This is a re-land of r317019, which had issues with GCC 4.8 back then. Those issues don't reproduce anymore, but I'll watch the buildbots closely in case anything goes wrong. llvm-svn: 322838
* Revert "Add a value_type to ArrayRef."Clement Courbet2018-01-181-8/+0
| | | | | | | | clang OOMs on arm. This reverts commit a272b2f2ef63f7f602c9ef4d9e10dc4eb9f00aa1. llvm-svn: 322818
* Add a value_type to ArrayRef.Clement Courbet2018-01-161-0/+8
| | | | | | | | | | Summary: Not sure this needs a review or not. Erring on the safe side. Reviewers: dblaikie Differential Revision: https://reviews.llvm.org/D41666 llvm-svn: 322538
* Use size_t to represent the size of a StringMapEntry length and alignment ↵Aaron Ballman2018-01-111-0/+40
| | | | | | | | rather than unsigned. Patch by Matt Davis. llvm-svn: 322305
* Fix APFloat from string conversion for InfSerguei Katkov2017-12-192-1/+23
| | | | | | | | | | | | | | | | | | 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(). Re-landing after fix. Reviewers: sberg, bogner, majnemer, timshen, rnk, skatkov, gottesmm, bkramer, scanon, anna Reviewed By: anna Subscribers: mkazantsev, FlameTop, llvm-commits, reames, apilipenko Differential Revision: https://reviews.llvm.org/D38030 llvm-svn: 321054
* Ensure moved-from container is cleared on moveGeorge Burgess IV2017-12-111-0/+6
| | | | | | | | | In all cases except for this optimistic attempt to reuse memory, the moved-from TinyPtrVector was left `empty()` at the end of this assignment. Though using a container after it's been moved from can be a bit sketchy, it's probably best to just be consistent here. llvm-svn: 320408
* [Support] Add unit test for printLowerCaseFrancis Visoiu Mistrih2017-11-281-0/+8
| | | | | | Add test case for the function added in r319171. llvm-svn: 319177
* [NFC] Add missing unit tests for EquivalenceClassesMax Kazantsev2017-11-272-0/+86
| | | | llvm-svn: 319018
* Add ADL support to range based <algorithm> extensionsDavid Blaikie2017-11-201-14/+52
| | | | | | | | | | | | | | | | | This adds support for ADL in the range based <algorithm> extensions (llvm::for_each etc.). Also adds the helper functions llvm::adl::begin and llvm::adl::end which wrap std::begin and std::end with ADL support. Saw this was missing from a recent llvm weekly post about adding llvm::for_each and thought I might add it. Patch by Stephen Dollberg! Differential Revision: https://reviews.llvm.org/D40006 llvm-svn: 318703
* [ADT] Rewrite mapped_iterator in terms of iterator_adaptor_base.Lang Hames2017-11-102-0/+52
| | | | | | | | | | | | | | | | | | Summary: This eliminates the boilerplate implementation of the iterator interface in mapped_iterator. This patch also adds unit tests that verify that the mapped function is applied by operator* and operator->, and that references returned by the map function are returned via operator*. Reviewers: dblaikie, chandlerc Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D39855 llvm-svn: 317902
* Add llvm::for_each as a range-based extensions to <algorithm> and make use ↵Aaron Ballman2017-11-031-6/+14
| | | | | | of it in some cases where it is a more clear alternative to std::for_each. llvm-svn: 317356
* Fix APFloat mod signSerguei Katkov2017-11-011-0/+14
| | | | | | | | | | | | fmod specification requires the sign of the remainder is the same as numerator in case remainder is zero. Reviewers: gottesmm, scanon, arsenm, davide, craig.topper Reviewed By: scanon Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D39225 llvm-svn: 317081
* 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
OpenPOWER on IntegriCloud