1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

420 Commits

Author SHA1 Message Date
David Blaikie
abe7833c2f Update test name to match changes made in r218783
Addressing post commit review feedback from Justin Bogner.

llvm-svn: 218821
2014-10-01 21:19:39 +00:00
David Blaikie
7b8bbd0e46 Add an immovable type to test Optional<T>::emplace more rigorously after r218732.
llvm-svn: 218783
2014-10-01 18:29:44 +00:00
NAKAMURA Takumi
db6522181c ADTTests/OptionalTest.cpp: Use LLVM_DELETED_FUNCTION.
llvm-svn: 218750
2014-10-01 09:14:43 +00:00
Jordan Rose
9f866eaf0a Add an emplace(...) method to llvm::Optional<T>.
This can be used for in-place initialization of non-moveable types.
For compilers that don't support variadic templates, only up to four
arguments are supported. We can always add more, of course, but this
should be good enough until we move to a later MSVC that has full
support for variadic templates.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.
Reviewed by David Blaikie.

llvm-svn: 218732
2014-10-01 02:12:35 +00:00
Jordan Rose
546768112a Add getValueOr to llvm::Optional<T>.
This takes a single argument convertible to T, and
- if the Optional has a value, returns the existing value,
- otherwise, constructs a T from the argument and returns that.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

llvm-svn: 218618
2014-09-29 18:56:08 +00:00
Matt Arsenault
62b3e7bfd0 Add hsail and amdil64 to Triple
llvm-svn: 218142
2014-09-19 19:52:11 +00:00
Ed Maste
98616ed207 Add unit test for r217454
llvm-svn: 217786
2014-09-15 16:57:12 +00:00
David Blaikie
aa3930b088 Add some negative (and positive) static_assert checks for ArrayRef-of-pointer conversions introduced in r216709
llvm-svn: 216830
2014-08-31 01:33:41 +00:00
Craig Topper
dc6431e879 Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.
llvm-svn: 216821
2014-08-30 16:48:19 +00:00
Craig Topper
43cee2f5fc Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
2014-08-27 05:25:25 +00:00
Duncan P. N. Exon Smith
119044acf4 ADT: Unit test for ArrayRef::equals change in r215986
llvm-svn: 216008
2014-08-19 19:18:46 +00:00
David Blaikie
e490f547d3 Fix -Wsign-compare warnings
llvm-svn: 215483
2014-08-12 23:23:05 +00:00
Reid Kleckner
3f1f5c1808 APInt: Make self-move-assignment a no-op to fix stage3 clang-cl
It's not clear what the semantics of a self-move should be.  The
consensus appears to be that a self-move should leave the object in a
moved-from state, which is what our existing move assignment operator
does.

However, the MSVC 2013 STL will perform self-moves in some cases.  In
particular, when doing a std::stable_sort of an already sorted APSInt
vector of an appropriate size, one of the merge steps will self-move
half of the elements.

We don't notice this when building with MSVC, because MSVC will not
synthesize the move assignment operator for APSInt.  Presumably MSVC
does this because APInt, the base class, has user-declared special
members that implicitly delete move special members.  Instead, MSVC
selects the copy-assign operator, which defends against self-assignment.
Clang, on the other hand, selects the move-assign operator, and we get
garbage APInts.

llvm-svn: 215478
2014-08-12 22:01:39 +00:00
Saleem Abdulrasool
92b98299b9 ADT: remove MinGW32 and Cygwin OSType enum
Remove the MinGW32 and Cygwin types from the OSType enumeration.  These values
are represented via environments of Windows.  It is a source of confusion and
needlessly clutters the code.  The cost of doing this is that we must sink the
check for them into the normalization code path along with the spelling.

Addresses PR20592.

llvm-svn: 215303
2014-08-09 23:12:20 +00:00
Andrew Trick
f644021551 Fix SmallDenseMap assignment operator.
Self assignment would lead to buckets of garbage, causing quadratic probing to hang.

llvm-svn: 214790
2014-08-04 22:18:25 +00:00
Chandler Carruth
869b0d1406 [ADT] Add a remarkbly useful little helper routine to ArrayRef for
checking whether the ArrayRef is equal to an explicit list of arguments.

This is particularly easy to implement even without variadic templates
because ArrayRef happens to be homogeneously typed. As a consequence we
can use a "clever" wrapper type and default arguments to capture in
a single method many arguments as well as *how many* arguments the user
specified.

Thanks to Dave Blaikie for helping me pull together this little helper.
Suggestions for how to improve or generalize it are of course welcome.
I'll be using it immediately in my follow-up patch. =D

llvm-svn: 214041
2014-07-27 01:11:19 +00:00
Duncan P. N. Exon Smith
920db48687 ADT: Add MapVector::remove_if
Add a `MapVector::remove_if()` that erases items in bulk in linear time,
as opposed to quadratic time for repeated calls to `MapVector::erase()`.

llvm-svn: 213090
2014-07-15 20:24:56 +00:00
Duncan P. N. Exon Smith
d7051f69aa ADT: Fix MapVector::erase()
Actually update the changed indexes in the map portion of `MapVector`
when erasing from the middle.  Add a unit test that checks for this.

Note that `MapVector::erase()` is a linear time operation (it was and
still is).  I'll commit a new method in a moment called
`MapVector::remove_if()` that deletes multiple entries in linear time,
which should be slightly less painful.

llvm-svn: 213084
2014-07-15 18:32:30 +00:00
Argyrios Kyrtzidis
5daccdf69f Move the API and implementation of clang::driver::getARMCPUForMArch() to llvm::Triple::getARMCPUForArch().
Suggested by Eric Christopher.

llvm-svn: 212846
2014-07-11 21:44:54 +00:00
David Majnemer
410442b39d ADT: Add a drop_back() helper to ArrayRef
The slice(N, M) interface is powerful but not concise when wanting to
drop a few elements off of an ArrayRef, fix this by adding a drop_back
method.

llvm-svn: 212370
2014-07-05 06:12:30 +00:00
David Blaikie
a2e836b256 Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members.
Certain versions of GCC (~4.7) couldn't handle the SFINAE on access
control, but with "= delete" (hidden behind a macro for portability)
this issue is worked around/addressed.

Patch by Agustín Bergé

llvm-svn: 211525
2014-06-23 18:28:53 +00:00
David Blaikie
f279d4f048 Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
llvm-svn: 211393
2014-06-20 19:54:13 +00:00
Rafael Espindola
b39185a826 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

llvm-svn: 211328
2014-06-20 00:23:03 +00:00
David Blaikie
f14625fbd8 Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

llvm-svn: 211309
2014-06-19 20:08:56 +00:00
Alp Toker
4d6e49afed Remove OwningPtr.h and associated tests
llvm::OwningPtr is superseded by std::unique_ptr.

llvm-svn: 211259
2014-06-19 07:25:18 +00:00
David Blaikie
01e532692b SmallVectorTest: Make the deleted member functions private to help MSVC users.
llvm-svn: 210665
2014-06-11 17:50:14 +00:00
Craig Topper
f86daf85d1 Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpliies all in tree call sites. No functional change.
llvm-svn: 210638
2014-06-11 05:35:56 +00:00
NAKAMURA Takumi
33c9311492 SmallVectorTest.cpp: Use LLVM_DELETED_FUNCTION.
llvm-svn: 210507
2014-06-10 04:06:56 +00:00
David Blaikie
b9110d7667 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.

llvm-svn: 210495
2014-06-09 22:26:20 +00:00
Craig Topper
b00824c629 [C++11] Use 'nullptr'.
llvm-svn: 210442
2014-06-08 22:29:17 +00:00
David Blaikie
a7b991031e 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.

llvm-svn: 210436
2014-06-08 19:33:40 +00:00
David Blaikie
fd04eace77 SmallVector: More movable improvements - don't copy elements to make space when inserting repeated elements.
Also split and improve tests a bit.

llvm-svn: 210433
2014-06-08 19:12:31 +00:00
David Blaikie
ed9ff7ecbb SmallVector: Move, don't copy, elements to make space for an insertion.
llvm-svn: 210432
2014-06-08 19:12:28 +00:00
David Blaikie
e2870900ae 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.

llvm-svn: 210430
2014-06-08 17:33:47 +00:00
David Blaikie
a97c319aa7 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)

llvm-svn: 210429
2014-06-08 16:55:13 +00:00
Stephen Canon
f8d21c729a 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.

llvm-svn: 210428
2014-06-08 16:53:31 +00:00
David Blaikie
7b67322aaf 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)

llvm-svn: 210426
2014-06-08 16:00:02 +00:00
David Blaikie
391e7a57eb Remove use of = default/= delete as they're unsupported on MSVC2012
llvm-svn: 208388
2014-05-09 02:26:36 +00:00
David Blaikie
336fe9979c Missed formatting
llvm-svn: 208362
2014-05-08 21:53:33 +00:00
David Blaikie
428752c172 StringMap: Move assignment and move construction.
llvm-svn: 208361
2014-05-08 21:52:29 +00:00
David Blaikie
02c16a31fb StringMap support for move-only values.
llvm-svn: 208359
2014-05-08 21:52:23 +00:00
Douglas Gregor
317f3d8838 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.

llvm-svn: 207663
2014-04-30 15:49:06 +00:00
Chandler Carruth
46cf170b93 [ADT] Teach PointerUnion to support assignment directly from nullptr to
clear it out.

llvm-svn: 207471
2014-04-29 00:14:27 +00:00
Chandler Carruth
b358251835 [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. =]

llvm-svn: 207468
2014-04-28 23:44:14 +00:00
Chandler Carruth
942da7ea4b [cleanup] Make this test use a proper fixture rather than globals.
llvm-svn: 207466
2014-04-28 23:42:22 +00:00
Chandler Carruth
fbc3cedcab [cleanup] Fix the whitespace in this test. Notably, correct spacing
around pointer types.

llvm-svn: 207465
2014-04-28 23:37:53 +00:00
Duncan P. N. Exon Smith
ea68e6a3d5 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>

llvm-svn: 207252
2014-04-25 18:24:50 +00:00
Benjamin Kramer
f6c0615b06 Retire llvm::array_endof in favor of non-member std::end.
While there make array_lengthof constexpr if we have support for it.

llvm-svn: 206112
2014-04-12 16:15:53 +00:00
Saleem Abdulrasool
db61071b5a 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.

llvm-svn: 205219
2014-03-31 16:34:41 +00:00
Tim Northover
15a133dcd6 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.

llvm-svn: 205132
2014-03-30 07:25:23 +00:00