summaryrefslogtreecommitdiff
path: root/unittests/ADT
Commit message (Collapse)AuthorAge
* SmallVectorTest: Make the deleted member functions private to help MSVC users.David Blaikie2014-06-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210665 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert StringMapEntry::Create to use StringRef instead of start/end ↵Craig Topper2014-06-11
| | | | | | pointers. Simpliies all in tree call sites. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210638 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVectorTest.cpp: Use LLVM_DELETED_FUNCTION.NAKAMURA Takumi2014-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210507 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVector: support resize(N) with move-only typesDavid Blaikie2014-06-09
| | | | | | | | | | | | | | | Unfortunately there's no way to elegantly do this with pre-canned algorithms. Using a generating iterator doesn't work because you default construct for each element, then move construct into the actual slot (bad for copy but non-movable types, and a little unneeded overhead even in the move-only case), so just write it out manually. This solution isn't exception safe (if one of the element's ctors calls we don't fall back, destroy the constructed elements, and throw on - which std::uninitialized_fill does do) but SmallVector (and LLVM) isn't exception safe anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210495 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-06-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210442 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVector: Improve test coverage for insert with repetitionDavid Blaikie2014-06-08
| | | | | | | | | | | | | To test cases that involve actual repetition (> 1 elements), at least one element before the insertion point, and some elements of the original range that still fit in that range space after insertion. Actually we need coverage for the inverse case too (where no elements after the insertion point fit into the previously allocated space), but this'll do for now, and I might end up rewriting bits of SmallVector to avoid that special case anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210436 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVector: More movable improvements - don't copy elements to make space ↵David Blaikie2014-06-08
| | | | | | | | when inserting repeated elements. Also split and improve tests a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210433 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVector: Move, don't copy, elements to make space for an insertion.David Blaikie2014-06-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210432 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVectorTest: Remove some more robust checks added in r210429 since they ↵David Blaikie2014-06-08
| | | | | | | | | | | caught some bugs I haven't fixed yet. Specifically this caused inserting an element from a SmallVector into itself when such an insertion would cause a reallocation. We have code to handle this for non-reallocating cases, but it's not robust against reallocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210430 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some more moving-from-moved-from objects issues in SmallVectorDavid Blaikie2014-06-08
| | | | | | | | (& because it makes it easier to test, this also improves correctness/performance slightly by moving the last element in an insert operation, rather than copying it) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210429 91177308-0d34-0410-b5e6-96231b3b80d8
* APFloat: x - NaN needs to flip the signbit of NaN when x is a number.Stephen Canon2014-06-08
| | | | | | Because we don't have a separate negate( ) function, 0 - NaN does double-duty as the IEEE-754 negate( ) operation, which (unlike most FP ops) *does* attach semantic meaning to the signbit of NaN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210428 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure SmallVector::insert doesn't overwrite the last element in the range ↵David Blaikie2014-06-08
| | | | | | | | | | | | | | with the already-moved-from value This would cause the last element in a range to be in a moved-from state after an insert at a non-end position, losing that value entirely in the process. Side note: move_backward is subtle. It copies [A, B) to C-1 and down. (the fact that it decrements both the second and third iterators before the first movement is the subtle part... kind of surprising, anyway) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210426 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove use of = default/= delete as they're unsupported on MSVC2012David Blaikie2014-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208388 91177308-0d34-0410-b5e6-96231b3b80d8
* Missed formattingDavid Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208362 91177308-0d34-0410-b5e6-96231b3b80d8
* StringMap: Move assignment and move construction.David Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208361 91177308-0d34-0410-b5e6-96231b3b80d8
* StringMap support for move-only values.David Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208359 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a use of uninitialized memory in SmallVector's move-assignment operator.Douglas Gregor2014-04-30
| | | | | | | | | When we were moving from a larger vector to a smaller one but didn't need to re-allocate, we would move-assign over uninitialized memory in the target, then move-construct that same data again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207663 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Teach PointerUnion to support assignment directly from nullptr toChandler Carruth2014-04-29
| | | | | | clear it out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207471 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Add some actual positive tests for equality. This unittestChandler Carruth2014-04-28
| | | | | | | never actually compared for equality two pointer unions that were equal. Fortunately, things seem to work. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207468 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Make this test use a proper fixture rather than globals.Chandler Carruth2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207466 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Fix the whitespace in this test. Notably, correct spacingChandler Carruth2014-04-28
| | | | | | around pointer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207465 91177308-0d34-0410-b5e6-96231b3b80d8
* SCC: Change clients to use const, NFCDuncan P. N. Exon Smith2014-04-25
| | | | | | | | | | It's fishy to be changing the `std::vector<>` owned by the iterator, and no one actual does it, so I'm going to remove the ability in a subsequent commit. First, update the users. <rdar://problem/14292693> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207252 91177308-0d34-0410-b5e6-96231b3b80d8
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-12
| | | | | | While there make array_lengthof constexpr if we have support for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206112 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: generalise object type handling for WindowsSaleem Abdulrasool2014-03-31
| | | | | | | | | This generalises the object file type parsing to all Windows environments. This is used by cygwin as well as MSVC environments for MCJIT. This also makes the triple more similar to Chandler's suggestion of a separate field for the object file format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205219 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM64: remove -m32/-m64 mapping with ARM.Tim Northover2014-03-30
| | | | | | | This is causing the ARM build-bots to fail since they only include the ARM backend and can't create an ARM64 target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205132 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: correct Windows normalisationSaleem Abdulrasool2014-03-30
| | | | | | | | | | | | | If the environment is unknown and no object file is provided, then assume an "MSVC" environment, otherwise, set the environment to the object file format. In the case that we have a known environment but a non-native file format for Windows (COFF) which is used for MCJIT, then append the custom file format to the triple as an additional component. This fixes the MCJIT tests on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205130 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM64: initial backend importTim Northover2014-03-29
| | | | | | | | | | | | This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
* Canonicalise Windows target triple spellingsSaleem Abdulrasool2014-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | Construct a uniform Windows target triple nomenclature which is congruent to the Linux counterpart. The old triples are normalised to the new canonical form. This cleans up the long-standing issue of odd naming for various Windows environments. There are four different environments on Windows: MSVC: The MS ABI, MSVCRT environment as defined by Microsoft GNU: The MinGW32/MinGW32-W64 environment which uses MSVCRT and auxiliary libraries Itanium: The MSVCRT environment + libc++ built with Itanium ABI Cygnus: The Cygwin environment which uses custom libraries for everything The following spellings are now written as: i686-pc-win32 => i686-pc-windows-msvc i686-pc-mingw32 => i686-pc-windows-gnu i686-pc-cygwin => i686-pc-windows-cygnus This should be sufficiently flexible to allow us to target other windows environments in the future as necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204977 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT/PointerIntPairTest.cpp: Appease msc17.NAKAMURA Takumi2014-03-10
| | | | | | | - Use constructor instead of initializer list. - Disable ManyUnusedBits for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203436 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Now that we have C++11 and I've replaced the use of thisChandler Carruth2014-03-09
| | | | | | | horrible smart pointer by std::unique_ptr and strict move semantics, rip this out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203392 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add llvm::make_unique, according to N3656.Ahmed Charles2014-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203387 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Clean up SmallString a bit"David Blaikie2014-03-09
| | | | | | | | | This reverts commit r203374. Ambiguities in assign... oh well. I'm just going to revert this and probably not try to recommit it as it's not terribly important. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203375 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up SmallString a bitDavid Blaikie2014-03-09
| | | | | | | | | | | Move a common utility (assign(iter, iter)) into SmallVector (some of the others could be moved there too, but this one seemed particularly generic) and replace repetitions overrides with using directives. And simplify SmallVector::assign(num, element) while I'm here rather than thrashing these files (that cause everyone to rebuild) again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203374 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80 cols.Ahmed Charles2014-03-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203346 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix EXPECT_* to not produce a compile warning.Eli Bendersky2014-03-07
| | | | | | | EXPECT_TRUE/FALSE is also more idiomatic for booleans than EXPECT_EQ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203284 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Update PointerIntPair to handle pointer types with more than 31 bits free.Jordan Rose2014-03-07
| | | | | | | | | | Previously, the assertions in PointerIntPair would try to calculate the value (1 << NumLowBitsAvailable); the inferred type here is 'int', so if there were more than 31 bits available we'd get a shift overflow. Also, add a rudimentary unit test file for PointerIntPair. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203273 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace LLVM-style type traits with C++11 standard ones.Benjamin Kramer2014-03-07
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203242 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: split object format out of environmentSaleem Abdulrasool2014-03-06
| | | | | | | | | | | This is a preliminary setup change to support a renaming of Windows target triples. Split the object file format information out of the environment into a separate entity. Unfortunately, file format was previously treated as an environment with an unknown OS. This is most obvious in the ARM subtarget where the handling for macho on an arbitrary platform switches to AAPCS rather than APCS (as per Apple's needs). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203160 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add release() to OwningPtr.Ahmed Charles2014-03-05
| | | | | | | This will make the transition to unique_ptr easier by allowing more incremental changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202949 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleaning up a bunch of pre-Visual C++ 2012 build hacks.Yaron Keren2014-03-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202806 91177308-0d34-0410-b5e6-96231b3b80d8
* Give APInt move semantics.Benjamin Kramer2014-03-02
| | | | | | | The interaction between defaulted operators and move elision isn't totally obvious, add a unit test so it doesn't break unintentionally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202662 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-02
| | | | | | Remove the old functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Switch all uses of the llvm_move macro to use std::moveChandler Carruth2014-03-02
| | | | | | directly, and remove the macro. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202612 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add support for OwningPtr<T> to be converted to and fromChandler Carruth2014-03-02
| | | | | | | | std::unique_ptr<T>. Patch by Ahmed Charles! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202609 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add unit tests for OwningPtr<T> in preparation for changes to makeChandler Carruth2014-03-02
| | | | | | | | | | it interoperate (minimally) with std::unique_ptr<T>. This is part of my plan to migrate LLVM to use std::unique_ptr with a minimal impact on out-of-tree code. Patch by Ahmed Charles with some minor cleanups (and bool casts) by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202608 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.Chandler Carruth2014-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202583 91177308-0d34-0410-b5e6-96231b3b80d8
* fix crash in SmallDenseMap copy constructorDuncan P. N. Exon Smith2014-02-25
| | | | | | | | | Prevent a crash in the SmallDenseMap copy constructor whenever the other map is not in small mode. <rdar://problem/14292693> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202206 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak an _MSC_VER ifdef to use typename with clang in a unittestReid Kleckner2014-02-13
| | | | | | | | | | | In theory, Clang should figure out how to parse this correctly without typename, but since this is the last TU that Clang falls back on in the self-host, I'm going to compromise and check for __clang__. And now Clang can self-host on -win32 without fallback! The 'check' and 'check-clang' targets both pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201358 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix layering StringRef copy using BumpPtrAllocator.Nick Kledzik2014-02-05
| | | | | | | | | | | Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy: StringRef myCopy = myStr.copy(myAllocator); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200885 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up whitespaceDuncan P. N. Exon Smith2014-01-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200579 91177308-0d34-0410-b5e6-96231b3b80d8