Commit Graph

398 Commits

Author SHA1 Message Date
Rafael Espindola
6fda71e05e Revert "Add StringMap::insert(pair) consistent with the standard associative container concept."
This reverts commit r211309.

It looks like it broke some bots:

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 00:23:03 +00:00
David Blaikie
4110a7ac7a Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 20:08:56 +00:00
Alp Toker
ba928e254e Remove OwningPtr.h and associated tests
llvm::OwningPtr is superseded by std::unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 07:25:18 +00:00
David Blaikie
e23e227a5c SmallVectorTest: Make the deleted member functions private to help MSVC users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210665 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 17:50:14 +00:00
Craig Topper
27be15cd36 Convert StringMapEntry::Create to use StringRef instead of start/end 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
2014-06-11 05:35:56 +00:00
NAKAMURA Takumi
6e02efd130 SmallVectorTest.cpp: Use LLVM_DELETED_FUNCTION.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210507 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 04:06:56 +00:00
David Blaikie
78b4fd3a4b SmallVector: support resize(N) with move-only types
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
2014-06-09 22:26:20 +00:00
Craig Topper
b177041dfa [C++11] Use 'nullptr'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 22:29:17 +00:00
David Blaikie
cab673f638 SmallVector: Improve test coverage for insert with repetition
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
2014-06-08 19:33:40 +00:00
David Blaikie
62dd118135 SmallVector: More movable improvements - don't copy elements to make space 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
2014-06-08 19:12:31 +00:00
David Blaikie
aa72ac7dad SmallVector: Move, don't copy, elements to make space for an insertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210432 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-08 19:12:28 +00:00
David Blaikie
16aac741f6 SmallVectorTest: Remove some more robust checks added in r210429 since they 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
2014-06-08 17:33:47 +00:00
David Blaikie
9262e52075 Fix some more moving-from-moved-from objects issues in SmallVector
(& 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
2014-06-08 16:55:13 +00:00
Stephen Canon
bef256f49b APFloat: x - NaN needs to flip the signbit of NaN when x is a number.
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
2014-06-08 16:53:31 +00:00
David Blaikie
e570687bd8 Ensure SmallVector::insert doesn't overwrite the last element in the range 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
2014-06-08 16:00:02 +00:00
David Blaikie
3fb66ae739 Remove use of = default/= delete as they're unsupported on MSVC2012
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208388 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-09 02:26:36 +00:00
David Blaikie
50f8a53856 Missed formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208362 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:53:33 +00:00
David Blaikie
2b94fa799b StringMap: Move assignment and move construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208361 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:52:29 +00:00
David Blaikie
b0439e6d6a StringMap support for move-only values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208359 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 21:52:23 +00:00
Douglas Gregor
3bdb9015b1 Fix a use of uninitialized memory in SmallVector's move-assignment operator.
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
2014-04-30 15:49:06 +00:00
Chandler Carruth
4ef6c0908b [ADT] Teach PointerUnion to support assignment directly from nullptr to
clear it out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207471 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-29 00:14:27 +00:00
Chandler Carruth
b86c32fe38 [cleanup] Add some actual positive tests for equality. This unittest
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
2014-04-28 23:44:14 +00:00
Chandler Carruth
e3976b241c [cleanup] Make this test use a proper fixture rather than globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207466 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28 23:42:22 +00:00
Chandler Carruth
e753df3566 [cleanup] Fix the whitespace in this test. Notably, correct spacing
around pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207465 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28 23:37:53 +00:00
Duncan P. N. Exon Smith
db8c1ae04e SCC: Change clients to use const, NFC
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
2014-04-25 18:24:50 +00:00
Benjamin Kramer
15c435a367 Retire llvm::array_endof in favor of non-member std::end.
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
2014-04-12 16:15:53 +00:00
Saleem Abdulrasool
bd5fac585e Support: generalise object type handling for Windows
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
2014-03-31 16:34:41 +00:00
Tim Northover
e69ff5b01d ARM64: remove -m32/-m64 mapping with ARM.
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
2014-03-30 07:25:23 +00:00
Saleem Abdulrasool
b52cb5e0db Support: correct Windows normalisation
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
2014-03-30 07:19:31 +00:00
Tim Northover
7b837d8c75 ARM64: initial backend import
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
2014-03-29 10:18:08 +00:00
Saleem Abdulrasool
2ea701e67a Canonicalise Windows target triple spellings
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
2014-03-27 22:50:05 +00:00
NAKAMURA Takumi
804ff19273 ADT/PointerIntPairTest.cpp: Appease msc17.
- 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
2014-03-10 02:33:17 +00:00
Chandler Carruth
f328eebf32 [C++11] Now that we have C++11 and I've replaced the use of this
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
2014-03-09 11:51:11 +00:00
Ahmed Charles
fee1963538 [C++11] Add llvm::make_unique, according to N3656.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203387 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 11:20:17 +00:00
David Blaikie
3e07f8a03d Revert "Clean up SmallString a bit"
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
2014-03-09 06:22:58 +00:00
David Blaikie
ed8ba2e58e Clean up SmallString a bit
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
2014-03-09 06:17:01 +00:00
Ahmed Charles
783b2222f8 Fix 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203346 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 12:51:31 +00:00
Eli Bendersky
2195ed675a Fix EXPECT_* to not produce a compile warning.
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
2014-03-07 21:04:24 +00:00
Jordan Rose
bc3b24269e [ADT] Update PointerIntPair to handle pointer types with more than 31 bits free.
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
2014-03-07 19:19:56 +00:00
Benjamin Kramer
c1dafe8dc3 [C++11] Replace LLVM-style type traits with C++11 standard ones.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203242 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 14:42:25 +00:00
Saleem Abdulrasool
4eb048a6f1 Support: split object format out of environment
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
2014-03-06 20:47:11 +00:00
Ahmed Charles
b6193185a0 [C++11] Add release() to OwningPtr.
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
2014-03-05 08:25:08 +00:00
Yaron Keren
b62b44ccc5 Cleaning up a bunch of pre-Visual C++ 2012 build hacks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202806 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 09:23:33 +00:00
Benjamin Kramer
3efb8b2c0f Give APInt move semantics.
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
2014-03-02 20:56:28 +00:00
Benjamin Kramer
d628f19f5d [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
Remove the old functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 12:27:27 +00:00
Chandler Carruth
0a3eef53d7 [C++11] Switch all uses of the llvm_move macro to use std::move
directly, and remove the macro.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202612 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 04:08:41 +00:00
Chandler Carruth
80949c599f [C++11] Add support for OwningPtr<T> to be converted to and from
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
2014-03-02 03:38:32 +00:00
Chandler Carruth
fd18fcb111 [C++11] Add unit tests for OwningPtr<T> in preparation for changes to make
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
2014-03-02 03:26:39 +00:00
Chandler Carruth
bad2104d24 [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202583 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 09:36:06 +00:00
Duncan P. N. Exon Smith
e8aeccef15 fix crash in SmallDenseMap copy constructor
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
2014-02-25 23:35:13 +00:00