Commit Graph

1242 Commits

Author SHA1 Message Date
Chandler Carruth 999b92d5aa [PM] As was pointed out in review, I need to define a custom swap in
order to use the single assignment. That's probably worth doing for
a lot of these types anyways as they may have non-trivial moves and so
getting copy elision in more places seems worthwhile.

I've tried to add some tests that actually catch this mistake, and one
of the types is now well tested but the others' tests still fail to
catch this. I'll keep working on tests, but this gets the core pattern
right.

llvm-svn: 203780
2014-03-13 10:42:18 +00:00
Justin Bogner f404b93576 unittests: Fix -Werror build
llvm-svn: 203679
2014-03-12 17:00:52 +00:00
Eli Bendersky 09a95e0b12 Add parens around && clauses in a || to appease the compiler.
Otherwise gcc 4.8.2 generates a warning.

llvm-svn: 203671
2014-03-12 16:14:53 +00:00
Alon Mishne 07d949f39a Cloning a function now also clones its debug metadata if 'ModuleLevelChanges' is true.
llvm-svn: 203662
2014-03-12 14:42:51 +00:00
Saleem Abdulrasool afc50b3ed4 support: add a utility function to normalise path separators
Add a utility function to convert the Windows path separator to Unix style path
separators.  This is used by a subsequent change in clang to enable the use of
Windows SDK headers on Linux.

llvm-svn: 203611
2014-03-11 22:05:42 +00:00
Rafael Espindola 83f858e578 Cleanup the interface for creating soft or hard links.
Before this patch the unix code for creating hardlinks was unused. The code
for creating symbolic links was implemented in lib/Support/LockFileManager.cpp
and the code for creating hard links in lib/Support/*/Path.inc.

The only use we have for these is in LockFileManager.cpp and it can use both
soft and hard links. Just have a create_link function that creates one or the
other depending on the platform.

llvm-svn: 203596
2014-03-11 18:40:24 +00:00
NAKAMURA Takumi 8800becdd1 MultiJITTest.cpp: Tweak getPointerToNamedFunction() to be aware of also Windows x64.
In import thunk, jmp is:
  - On x86, 0xFF 0x25 [disp32].
  - On x64, 0xFF 0x25 [pcrel32].

See also my r144178.

llvm-svn: 203523
2014-03-11 00:34:38 +00:00
NAKAMURA Takumi 8346167fab ADT/PointerIntPairTest.cpp: Appease msc17.
- Use constructor instead of initializer list.
  - Disable ManyUnusedBits for now.

llvm-svn: 203436
2014-03-10 02:33:17 +00:00
Chandler Carruth 5ae74a6af2 [PM] While I'm here, fix a few other clang-format issues. Pulls some
lines under 80-columns, etc.

llvm-svn: 203434
2014-03-10 02:12:14 +00:00
Chandler Carruth 3056818033 [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.

llvm-svn: 203392
2014-03-09 11:51:11 +00:00
Chandler Carruth c3f3da3d21 [PM] Switch new pass manager from polymorphic_ptr to unique_ptr now that
it is available. Also make the move semantics sufficiently correct to
tolerate move-only passes, as the PassManagers *are* move-only passes.

llvm-svn: 203391
2014-03-09 11:49:53 +00:00
Ahmed Charles f9d26f1b78 [C++11] Add llvm::make_unique, according to N3656.
llvm-svn: 203387
2014-03-09 11:20:17 +00:00
David Blaikie 259a5a649f 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.

llvm-svn: 203375
2014-03-09 06:22:58 +00:00
David Blaikie d028adf7bc 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.

llvm-svn: 203374
2014-03-09 06:17:01 +00:00
Ahmed Charles 007bf9a541 Fix 80 cols.
llvm-svn: 203346
2014-03-08 12:51:31 +00:00
Eli Bendersky 4ccce1b728 Fix EXPECT_* to not produce a compile warning.
EXPECT_TRUE/FALSE is also more idiomatic for booleans than EXPECT_EQ

llvm-svn: 203284
2014-03-07 21:04:24 +00:00
Jordan Rose 05f44b4d1c [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.

llvm-svn: 203273
2014-03-07 19:19:56 +00:00
Benjamin Kramer bcc77b04bb [C++11] Now that the users are gone, rip out the duplicated traits from type_traits.h
Simplify the remaining ones a bit.

llvm-svn: 203249
2014-03-07 15:54:23 +00:00
Benjamin Kramer f04ddd01c9 [C++11] Replace LLVM-style type traits with C++11 standard ones.
No functionality change.

llvm-svn: 203242
2014-03-07 14:42:25 +00:00
Saleem Abdulrasool 35476334e9 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).

llvm-svn: 203160
2014-03-06 20:47:11 +00:00
Ahmed Charles 56440fd820 Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes
overloads to various functions which are used by those projects and llvm
which have OwningPtr's as parameters. This should allow out of tree
projects some time to move. There are also no changes to libs/Target,
which should help out of tree targets have time to move, if necessary.

llvm-svn: 203083
2014-03-06 05:51:42 +00:00
Chandler Carruth 6cc07df4ec [Layering] Sink Linker.h into a Linker subdirectory to make it
consistent with every other sub-library header in LLVM.

llvm-svn: 203065
2014-03-06 03:42:23 +00:00
Chandler Carruth 9a4c9e597b [Layering] Move DebugInfo.h into the IR library where its implementation
already lives.

llvm-svn: 203046
2014-03-06 00:46:21 +00:00
Chandler Carruth 12664a0b17 [Layering] Move DIBuilder.h into the IR library where its implementation
already lives.

llvm-svn: 203038
2014-03-06 00:22:06 +00:00
Ben Langmuir 8d11639612 Fix an inconsistency in treatment of trailing / in path::const_iterator
When using a //net/ path, we were transforming the trailing / into a '.'
when the path was just the root path and we were iterating backwards.
Forwards iteration and other kinds of root path (C:\, /) were already
correct.

llvm-svn: 202999
2014-03-05 19:56:30 +00:00
Ahmed Charles fba066461f [C++11] Add overloads for externally used OwningPtr functions.
This will allow external callers of these functions to switch over time
rather than forcing a breaking change all a once. These particular
functions were determined by building clang/lld/lldb.

llvm-svn: 202959
2014-03-05 10:27:34 +00:00
Ahmed Charles 96c9d95f51 [C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
2014-03-05 10:19:29 +00:00
Ahmed Charles b5dab28db5 [C++11] Add release() to OwningPtr.
This will make the transition to unique_ptr easier by allowing more
incremental changes.

llvm-svn: 202949
2014-03-05 08:25:08 +00:00
Chandler Carruth b475b42a88 Hey, we can stop depending on the IR library from the Support unittests
now. ;] Tested on both a static and shared CMake build. Hopefully the
bots will agree.

llvm-svn: 202844
2014-03-04 12:56:38 +00:00
Chandler Carruth 4b6845c7e7 [Modules] Move the LeakDetector header into the IR library where the
source file had already been moved. Also move the unittest into the IR
unittest library.

This may seem an odd thing to put in the IR library but we only really
use this with instructions and it needs the LLVM context to work, so it
is intrinsically tied to the IR library.

llvm-svn: 202842
2014-03-04 12:46:06 +00:00
Chandler Carruth 8cd041ef19 [Modules] Move the ConstantRange class into the IR library. This is
a bit surprising, as the class is almost entirely abstracted away from
any particular IR, however it encodes the comparsion predicates which
mutate ranges as ICmp predicate codes. This is reasonable as they're
used for both instructions and constants. Thus, it belongs in the IR
library with instructions and constants.

llvm-svn: 202838
2014-03-04 12:24:34 +00:00
Chandler Carruth 64396b069a [Modules] Move the NoFolder into the IR library as it creates
instructions.

llvm-svn: 202834
2014-03-04 12:05:47 +00:00
Chandler Carruth a4ea269f15 [Modules] Move ValueMap to the IR library. While this class does not
directly care about the Value class (it is templated so that the key can
be any arbitrary Value subclass), it is in fact concretely tied to the
Value class through the ValueHandle's CallbackVH interface which relies
on the key type being some Value subclass to establish the value handle
chain.

Ironically, the unittest is already in the right library.

llvm-svn: 202824
2014-03-04 11:26:31 +00:00
Chandler Carruth 4220e9c154 [Modules] Move ValueHandle into the IR library where Value itself lives.
Move the test for this class into the IR unittests as well.

This uncovers that ValueMap too is in the IR library. Ironically, the
unittest for ValueMap is useless in the Support library (honestly, so
was the ValueHandle test) and so it already lives in the IR unittests.
Mmmm, tasty layering.

llvm-svn: 202821
2014-03-04 11:17:44 +00:00
Chandler Carruth 820a908df7 [Modules] Move the LLVM IR pattern match header into the IR library, it
obviously is coupled to the IR.

llvm-svn: 202818
2014-03-04 11:08:18 +00:00
Chandler Carruth 8394857f43 [Modules] Move InstIterator out of the Support library, where it had no
business.

This header includes Function and BasicBlock and directly uses the
interfaces of both classes. It has to do with the IR, it even has that
in the name. =] Put it in the library it belongs to.

This is one step toward making LLVM's Support library survive a C++
modules bootstrap.

llvm-svn: 202814
2014-03-04 10:30:26 +00:00
Chandler Carruth 442f784814 [cleanup] Re-sort all the includes with utils/sort_includes.py.
llvm-svn: 202811
2014-03-04 10:07:28 +00:00
Yaron Keren 225d550b05 Cleaning up a bunch of pre-Visual C++ 2012 build hacks.
llvm-svn: 202806
2014-03-04 09:23:33 +00:00
Benjamin Kramer 49c8ae21f5 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.

llvm-svn: 202662
2014-03-02 20:56:28 +00:00
Chandler Carruth cf01800b1f [C++11] Replace LLVM_STATIC_ASSERT with static_assert, we now have
access to it on all host toolchains.

llvm-svn: 202642
2014-03-02 13:10:45 +00:00
Benjamin Kramer b6d0bd48bd [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
Remove the old functions.

llvm-svn: 202636
2014-03-02 12:27:27 +00:00
Craig Topper 73156025e0 Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
llvm-svn: 202621
2014-03-02 09:09:27 +00:00
Chandler Carruth 002da5db29 [C++11] Switch all uses of the llvm_move macro to use std::move
directly, and remove the macro.

llvm-svn: 202612
2014-03-02 04:08:41 +00:00
Chandler Carruth 871171a25b [C++11] Add support for OwningPtr<T> to be converted to and from
std::unique_ptr<T>.

Patch by Ahmed Charles!

llvm-svn: 202609
2014-03-02 03:38:32 +00:00
Chandler Carruth 337bd07978 [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.

llvm-svn: 202608
2014-03-02 03:26:39 +00:00
Chandler Carruth f4cde83d3a [C++11] Remove LLVM_HAS_CXX11_STDLIB now that it is just on.
llvm-svn: 202587
2014-03-01 10:57:19 +00:00
Chandler Carruth 667363b3e3 [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.
llvm-svn: 202583
2014-03-01 09:36:06 +00:00
Rafael Espindola 11ac853774 With rpaths being set correctly, SHLIBPATH_VAR is not needed anymore.
llvm-svn: 202510
2014-02-28 16:16:51 +00:00
Rafael Espindola 9e806cf938 Correctly set rpath for unittests.
This lets us run the unittest from the command line without setting
LD_LIBRARY_PATH.

llvm-svn: 202509
2014-02-28 16:11:03 +00:00
David Blaikie 51a184058d Use the overloaded std::abs rather than C's abs(int) to address Clang's -Wabsolute-value
llvm-svn: 202286
2014-02-26 19:12:28 +00:00