Commit Graph

499 Commits

Author SHA1 Message Date
David Blaikie
20dead8d0c Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 19:54:13 +00:00
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
Reid Kleckner
f2df02b355 Tweak an _MSC_VER ifdef to use typename with clang in a unittest
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
2014-02-13 19:51:13 +00:00
Nick Kledzik
8147752976 Fix layering StringRef copy using BumpPtrAllocator.
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
2014-02-05 22:22:56 +00:00
Duncan P. N. Exon Smith
42e0bc88a3 Clean up whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200579 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31 21:45:51 +00:00
Alp Toker
650e286dcf Roll back the ConstStringRef change for now
There are a couple of interesting things here that we want to check over
(particularly the expecting asserts in StringRef) and get right for general use
in ADT so hold back on this one. For clang we have a workable templated
solution to use in the meanwhile.

This reverts commit r200187.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200194 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-27 05:24:39 +00:00
Alp Toker
bad91954cf StringRef: Extend constexpr capabilities and introduce ConstStringRef
(1) Add llvm_expect(), an asserting macro that can be evaluated as a constexpr
    expression as well as a runtime assert or compiler hint in release builds. This
    technique can be used to construct functions that are both unevaluated and
    compiled depending on usage.

(2) Update StringRef using llvm_expect() to preserve runtime assertions while
    extending the same checks to static asserts in C++11 builds that support the
    feature.

(3) Introduce ConstStringRef, a strong subclass of StringRef that references
    compile-time constant strings. It's convertible to, but not from, ordinary
    StringRef and thus can be used to add compile-time safety to various interfaces
    in LLVM and clang that only accept fixed inputs such as diagnostic format
    strings that tend to get misused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200187 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-27 04:07:17 +00:00
Michael Gottesman
7320de5ce2 [APInt] Fix nearestLogBase2 to return correct answers for very large APInt and APInt with a bitwidth of 1.
I also improved the comments, added some more tests, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199610 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-19 20:33:48 +00:00
Michael Gottesman
e7413972a4 [APInt] Fixed bug where APInt(UINT32_MAX, 0) would blow up when being constructed.
This was due to arithmetic overflow in the getNumBits() computation. Now we
cast BitWidth to a uint64_t so that does not occur during the computation. After
the computation is complete, the uint64_t is truncated when the function
returns.

I know that this is not something that is likely to happen, but it *IS* a valid
input and we should not blow up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199609 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-19 20:33:38 +00:00
Chandler Carruth
974a445bd9 Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-07 11:48:04 +00:00
David Blaikie
303421884a Fix break introduced in r198377 due to using a local type as a template parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198379 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 00:00:41 +00:00
David Blaikie
4c9b681d6d Test coverage for non-default-constructible elements in a StringMap
This functionality was enabled by r198374. Here's a test to ensure it
works and we don't regress it.

Based on a patch by Maciej Piechotka.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-02 23:57:28 +00:00
David Blaikie
a11df460ac Remove StringMapEntryInitializer support.
It was never specialized so let's just remove that unused
configurability and always do the default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-02 23:28:39 +00:00
Anna Zaks
629f3b229e Fix a buffer overrun detected by AddressSanitizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197647 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 02:35:26 +00:00
Michael Gottesman
cadf450e17 Remove APInt::extractBit since it is already implemented via operator[]. Change tests for extractBit to test operator[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197277 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 22:00:19 +00:00
Michael Gottesman
46f829ee25 [block-freq] Add the method APInt::nearestLogBase2().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197272 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 20:47:37 +00:00
Michael Gottesman
5bb504f4ea [block-freq] Add the APInt method extractBit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197271 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 20:47:34 +00:00
Tim Northover
9f84f21a4c Darwin: update default iOS version to 5.0
Defaulting to iOS 3.0 when LLVM has to guess the version is no longer a useful
option and can give surprising results (like tail calls being disabled).

5.0 seems like a reasonable compromise as a platform that's still interesting
to some people.

rdar://problem/15567348

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196912 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-10 11:53:16 +00:00
Chandler Carruth
fd03357c25 Make the moved-from SmallPtrSet be a valid, empty, small-state object.
Enhance the tests to actually require moves in C++11 mode, in addition
to testing the moved-from state. Further enhance the tests to cover
copy-assignment into a moved-from object and moving a large-state
object. (Note that we can't really test small-state vs. large-state as
that isn't an observable property of the API really.) This should finish
addressing review on r195239.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195261 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 18:29:56 +00:00
Chandler Carruth
aa8e535b57 Add a test for assignment operator behavior which was changed in
r195239, as well as a comment about the fact that assigning over
a moved-from object was in fact tested. Addresses some of the review
feedback on r195239.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195260 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 18:21:25 +00:00
Chandler Carruth
46198164b3 Give SmallPtrSet move semantics when we have R-value references.
Somehow, this ADT got missed which is moderately terrifying considering
the efficiency of move for it.

The code to implement move semantics for it is pretty horrible
currently but was written to reasonably closely match the rest of the
code. Unittests that cover both copying and moving (at a basic level)
added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 11:14:33 +00:00
Juergen Ributzka
ba0f991a78 [weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous
namespaces to prevent weak vtables. This eliminates the need of providing an
out-of-line definition to pin the vtable explicitly to the file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195092 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 03:08:35 +00:00
Juergen Ributzka
354362524a [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 00:57:56 +00:00
Alexey Samsonov
b21ab43cfc Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 09:31:53 +00:00
Juergen Ributzka
5a364c5561 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 22:34:48 +00:00
Chandler Carruth
3c3f6be0c8 Fix a null pointer dereference when copying a null polymorphic pointer.
This bug only bit the C++98 build bots because all of the actual uses
really do move. ;] But not *quite* ready to do the whole C++11 switch
yet, so clean it up. Also add a unit test that catches this immediately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194548 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-13 02:48:20 +00:00
Chandler Carruth
3481cdc573 Switch to allow implicit construction. In many cases, we're wrapping
a derived type and this makes it *much* easier to write this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194321 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 05:55:03 +00:00
Chandler Carruth
c197a3ab4d Test the polymorphic behavior of this utility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194320 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:58:13 +00:00
Chandler Carruth
8caea7237a Use something really explicit to test "move semantics" on builds without
r-value references. I still want to test that when we have them,
llvm_move is actually a move.

Have I mentioned that I really want to move to C++11? ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194318 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:49:27 +00:00
Chandler Carruth
ca020d469e Add the critically missing 'clone' method. =]
Clang managed to never instantiate the copy constructor. Added tests to
ensure this path is tested.

We could still use tests for the polymorphic nature. Those coming up
next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194317 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:32:34 +00:00
Chandler Carruth
cd7a191d8a Move the test type out of the function and into the anonymous namespace
to fix C++98 builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194316 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:09:50 +00:00
Chandler Carruth
aec427786b Add a polymorphic_ptr<T> smart pointer data type. It's a somewhat silly
unique ownership smart pointer which is *deep* copyable by assuming it
can call a T::clone() method to allocate a copy of the owned data.

This is mostly useful with containers or other collections of uniquely
owned data in C++98 where they *might* copy. With C++11 we can likely
remove this in favor of move-only types and containers wrapped around
those types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194315 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-09 04:06:02 +00:00
Rui Ueyama
f34c3ca304 Add {start,end}with_lower methods to StringRef.
startswith_lower is ocassionally useful and I think worth adding.
endwith_lower is added for completeness.

Differential Revision: http://llvm-reviews.chandlerc.com/D2041

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193706 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 18:32:26 +00:00
Rui Ueyama
bc850d0c6c Add a few tests for StringRef::{start,end}with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193550 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-28 22:42:54 +00:00
Joerg Sonnenberger
f57a80f494 Add a Python-like join function to merge a list of strings with a
separator between each two elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189846 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 20:43:54 +00:00
Eli Friedman
1053a0b9b4 Change default # of digits for APFloat::toString
This is a re-commit of r189442; I'll follow up with clang changes.

The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-29 23:44:34 +00:00
Ted Kremenek
9006170945 Revert r189442 "Change default # of digits for APFloat::toString"
This is breaking numerous Clang tests on the buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 06:21:46 +00:00
Eli Friedman
631bce51b9 Change default # of digits for APFloat::toString
The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189442 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 05:23:51 +00:00
David Blaikie
296ca41b2d Basic unit tests for PointerUnion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188933 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-21 21:30:23 +00:00
Michael Gottesman
ca4d2e60ea [APFloat] Make all arithmetic operations with NaN produce positive NaNs.
IEEE-754R 1.4 Exclusions states that IEEE-754R does not specify the
interpretation of the sign of NaNs. In order to remove an irrelevant
variable that most floating point implementations do not use,
standardize add, sub, mul, div, mod so that operating anything with
NaN always yields a positive NaN.

In a later commit I am going to update the APIs for creating NaNs so
that one can not even create a negative NaN.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187314 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-27 21:49:25 +00:00
Rafael Espindola
496cf2308a Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-26 22:13:57 +00:00
Bill Schmidt
d063a326b2 [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187248 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-26 21:39:15 +00:00
Eli Friedman
763c066dca Handle '.' correctly in hex float literal parsing.
There were a couple of different loops that were not handling
'.' correctly in APFloat::convertFromHexadecimalString; these mistakes
could lead to assertion failures and incorrect rounding for overlong
hex float literals.

Fixes PR16643.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 22:17:29 +00:00
Benjamin Kramer
459d7bf8f6 Sync SmallBitVector with BitVector. Add unit tests for the missing methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186123 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 21:59:16 +00:00
Michael Gottesman
b57770387a [APFloat] Ensure that we can properly parse strings that do not have null terminators.
rdar://14323230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 23:54:08 +00:00
Michael Gottesman
fb76ffd10b [APFloat] Added unittest for APFloat.divide that checks special cases, result categories, and result statuses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185050 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:42:00 +00:00
Michael Gottesman
bb77593765 Removed two logging printf statements from the APFloat tests... = /.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:00:45 +00:00
Michael Gottesman
2eda897c3c [APFloat] Added unittest for APFloat.multiply that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:26 +00:00
Michael Gottesman
d7d88d969e [APFloat] Added unittest for APFloat.subtract that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:23 +00:00
Michael Gottesman
a8f9364461 [APFloat] Removed debugging cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184974 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 17:59:36 +00:00
Michael Gottesman
567a1126fb [APFloat] Removed trailing whitespace from unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:09 +00:00
Michael Gottesman
683069ffba [APFloat] Added a large unittest for APFloat.add that checks that special values are computed correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:07 +00:00
Michael Gottesman
a1694e5784 [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.
The old isNormal is already functionally replaced by the method isFiniteNonZero
in r184350 and all references to said method were replaced in LLVM/clang in
r184356/134366.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:34:38 +00:00
Michael Gottesman
3781fbc29a [APFloat] Fix typo in test so we actually test if we handle denormals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:25:16 +00:00
Michael Gottesman
4f71c1b2b9 [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all tests in unittests.
I forgot to to do this in r184356. The only references were in APFloatTest.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:53:45 +00:00
Michael Gottesman
7032c883cd [APFloat] Added isFiniteNonZero predicate.
This is the first patch in a series of patches to rename isNormal =>
isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless
errors on my part the overall plan is:

1. Add the isFiniteNonZero predicate with tests. I can do this in a method
independent of isNormal. (This step is this patch).
2. Convert all references to isNormal with isFiniteNonZero. My plan is to
comment out isNormal locally and continually convert isNormal references =>
isFiniteNonZero until llvm/clang compiles.
3. Remove old isNormal and rename isIEEENormal to isNormal.
4. Look through all of said references from patch 2 and see if we can simplify
them by using the new isNormal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:00:17 +00:00
Benjamin Kramer
a77376dae1 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 15:14:31 +00:00
Benjamin Kramer
597253da97 Optimize BitVector::all().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 14:14:38 +00:00
Michael Gottesman
b30718af1a IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04 03:46:25 +00:00
Benjamin Kramer
44dbb749f0 Try to avoid "integer literal too big" warnings from older GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-01 22:29:41 +00:00
Michael Gottesman
504e2da08c [APFloat] Added a unittest for APFloat::getZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183028 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 18:43:34 +00:00
Michael Gottesman
964722ca40 Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 18:07:13 +00:00
Michael Gottesman
999c693694 Added a unittest for APFloat::getSmallestNormalized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182897 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:47 +00:00
Michael Gottesman
7d13d525bc Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.
I additionally changed certain checks to use EXPECT_FALSE instead of a boolean
complement with EXPECT_TRUE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182896 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:44 +00:00
Michael Gottesman
3e8d356b81 Add a unittest for APFloat::getSmallest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29 23:58:29 +00:00
Michael Gottesman
a32edcfbc5 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28 19:50:20 +00:00
Shuxin Yang
4b6b53b0ce Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-13 18:03:12 +00:00
Jean-Luc Duprat
e1e9366281 SmallVector and SmallPtrSet allocations now power-of-two aligned.
This time tested on both OSX and Linux.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178377 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 22:07:12 +00:00
Rafael Espindola
ef484a376c Revert "Fix allocations of SmallVector and SmallPtrSet so they are more prone to"
This reverts commit 617330909f.

It broke the bots:

/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest
/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure
Value of: v[i].getValue()
  Actual: 0
Expected: value
Which is: 2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178334 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 07:11:21 +00:00
Jean-Luc Duprat
617330909f Fix allocations of SmallVector and SmallPtrSet so they are more prone to
being power-of-two sized.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 05:45:22 +00:00
David Blaikie
485740205b Only include move-related Optional<T> tests when rvalue references are available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 07:58:45 +00:00
David Blaikie
ea72255f5b Add move ctor/assignment to Optional<T>
Code review feedback for r175580 by Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175729 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 07:55:39 +00:00
Benjamin Kramer
ad4da0fc32 Move the SplatByte helper to APInt and generalize it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 13:00:06 +00:00
David Blaikie
4318fc5e1e Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.
Code review feedback on r175580 from Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 06:25:36 +00:00
David Blaikie
a28eda7e40 Allow llvm::Optional to work with types without default constructors.
This generalizes Optional to require less from the T type by using aligned
storage for backing & placement new/deleting the T into it when necessary.

Also includes unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175580 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 00:26:04 +00:00
Douglas Gregor
1f1713ff7a Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175538 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 18:26:07 +00:00
Meador Inge
35b1423ee6 ADT: Correct APInt::getActiveWords for zero values
PR15138 was opened because of a segfault in the Bitcode writer.
The actual issue ended up being a bug in APInt where calls to
APInt::getActiveWords returns a bogus value when the APInt value
is 0.  This patch fixes the problem by ensuring that getActiveWords
returns 1 for 0 valued APInts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174641 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 18:36:50 +00:00
Michael Gottesman
69f60e7c4a Added a unit test for r173983 that verifies that Target.isiOS() works correctly.
As a bonus I put in some extra checks to make sure that we are identifying the
machine word of various Mac OS X/iOS targets appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173994 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 23:48:13 +00:00
Dmitri Gribenko
c73b7f7022 Add file to CMakeLists (file added in r173505)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173513 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:29:23 +00:00
Nick Lewycky
6bbf4ff9c5 Add an insert() method to MapVector. Adds the first MapVector unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:11:02 +00:00
Benjamin Kramer
bd7561ea29 APFloat: Make sure that we get a well-formed x87 NaN when converting from a smaller type.
Fixes PR15054.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173459 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 17:01:00 +00:00
NAKAMURA Takumi
421db34270 ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang on stage2, take two. [-Wsign-compare]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173144 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 10:39:31 +00:00
NAKAMURA Takumi
19f24454b5 ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang (libstdc++-4.5) on stage2. [-Wsign-compare]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 05:30:15 +00:00
Michael Ilseman
afe77f33b2 Introduce a new data structure, the SparseMultiSet, and changes to the MI scheduler to use it.
A SparseMultiSet adds multiset behavior to SparseSet, while retaining SparseSet's desirable properties. Essentially, SparseMultiSet provides multiset behavior by storing its dense data in doubly linked lists that are inlined into the dense vector. This allows it to provide good data locality as well as vector-like constant-time clear() and fast constant time find(), insert(), and erase(). It also allows SparseMultiSet to have a builtin recycler rather than keeping SparseSet's behavior of always swapping upon removal, which allows it to preserve more iterators. It's often a better alternative to a SparseSet of a growable container or vector-of-vector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173064 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:18:53 +00:00
Shuxin Yang
7aa1c321f0 Implement APFloat::isDenormal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171764 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 18:59:35 +00:00
Jakob Stoklund Olesen
7c5c12bd4d Add an iplist::clearAndLeakNodesUnsafely() function.
The iplist::clear() function can be quite expensive because it traverses
the entire list, calling deleteNode() and removeNodeFromList() on each
element. If node destruction and deallocation can be handled some other
way, clearAndLeakNodesUnsafely() can be used to jettison all nodes
without bringing them into cache.

The function name is meant to be ominous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171540 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 22:35:42 +00:00
Chandler Carruth
7f00f87767 Sort a few more #include lines in tools/... unittests/... and utils/...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171363 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 10:26:28 +00:00
Jakob Stoklund Olesen
7f1d6d688f Add an assertion for a likely ilist::splice() contract violation.
The single-element ilist::splice() function supports a noop move:

  List.splice(I, List, I);

The corresponding std::list function doesn't allow that, so add a unit
test to document that behavior.

This also means that

  List.splice(I, List, F);

is somewhat surprisingly not equivalent to

  List.splice(I, List, F, next(F));

This patch adds an assertion to catch the illegal case I == F above.
Alternatively, we could make I == F a legal noop, but that would make
ilist differ even more from std::list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 19:28:37 +00:00
Chandler Carruth
5a88dda4be Sort the #include lines for unittest/...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169250 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 10:23:08 +00:00
Chandler Carruth
4334dd96a9 Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.
Rationale:
1) This was the name in the comment block. ;]
2) It matches Clang's __has_feature naming convention.
3) It matches other compiler-feature-test conventions.

Sorry for the noise. =]

I've also switch the comment block to use a \brief tag and not duplicate
the name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168996 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 11:45:22 +00:00
Benjamin Kramer
6b370e615c Drop the limitation to IEEE floating point types from the fdiv of pow2 -> fmul transform.
This is safe for x87 long doubles and ppc double doubles too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 13:58:10 +00:00
Ulrich Weigand
69c9c8c4cf Implement arithmetic on APFloat with PPCDoubleDouble semantics by
treating it as if it were an IEEE floating-point type with 106-bit
mantissa.

This makes compile-time arithmetic on "long double" for PowerPC
in clang (in particular parsing of floating point constants)
work, and fixes all "long double" related failures in the test
suite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166951 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-29 18:09:01 +00:00
Pete Cooper
fbaf206f47 Fixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket if the number of values was exactly equal to the small capacity. This led to an infinite loop when finding a non-existent element
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 18:47:35 +00:00
Owen Anderson
e3f7be36c7 Fix a bug in the set(I,E)/reset(I,E) methods that I recently added. The boundary condition for checking if I and E were in the same word were incorrect, and, beyond that, the mask computation was not using a wide enough constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166015 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16 06:04:27 +00:00
Owen Anderson
3a1c35afbd Add range-based set()/reset() to BitVector. These allow fast setting/resetting of ranges of bits, particularly useful when dealing with very large BitVector's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165984 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 22:05:27 +00:00
Benjamin Kramer
baf522ab5f Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165908 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-14 16:06:09 +00:00
Benjamin Kramer
658c62862e Fix a typo that made ImmutableMap::getMaxElement() useless.
Add a basic unit test for ImmutableMap. Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165907 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-14 15:56:39 +00:00
Duncan Sands
2e522d0527 Add powerpc-ibm-aix to Triple. Patch by Kai.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165792 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12 11:08:57 +00:00
Nick Kledzik
436eaa88fd Use unsigned long long instead of uin64_t for OS where that matters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165147 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 19:27:25 +00:00
Benjamin Kramer
e25de4ae04 Don't call getAsUnsignedInteger directly, it fails to compile if uint64_t is not "unsigned long long".
while there add more test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165140 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 18:54:36 +00:00
Nick Kledzik
7a0f86fa78 Add getAsUnsignedInteger test case that checks that known bad values are rejected
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165136 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 18:15:27 +00:00