Commit Graph

2623 Commits

Author SHA1 Message Date
Saleem Abdulrasool
b0f12dfab6 Support: add support to identify WinCOFF/ARM objects
Add the Windows COFF ARM object file magic.  This enables the LLVM tools to
interact with COFF object files for Windows on ARM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203761 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 07:02:35 +00:00
Saleem Abdulrasool
404a72729b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203611 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 22:05:42 +00:00
Rafael Espindola
8acff70de1 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203596 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-11 18:40:24 +00:00
Craig Topper
49e139b7f7 [C++11] Remove 'virtual' keyword from methods marked with 'override' keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 03:53:12 +00:00
Bob Wilson
f749c23912 Fix inconsistent whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203423 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-09 23:17:28 +00:00
Benjamin Kramer
ba2a549016 [C++11] Revert uses of lambdas with array_pod_sort.
Looks like GCC implements the lambda->function pointer conversion differently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203294 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 21:52:38 +00:00
Benjamin Kramer
e1362f1ebd [C++11] Convert sort predicates into lambdas.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203288 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-07 21:35:39 +00:00
Argyrios Kyrtzidis
046c8e1a3a [Support/LockFileManager] Re-apply r203137 and r203138 but use symbolic links only on unix.
Reid Kleckner pointed out that we can't use symbolic links on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203162 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 20:53:58 +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
Reid Kleckner
bbf1c8d24c Revert create_symbolic_link and both depending changes
This reverts commits r203136, r203137, and r203138.

This code doesn't build on Windows.  Even on Vista+, Windows requires
elevated privileges to create a symlink.  Therefore we can't use
symlinks in the compiler.  We'll have to find another approach.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 19:07:35 +00:00
Argyrios Kyrtzidis
d25733bebc [Support/LockFileManager] Make the LockFileManager more robust against races.
There was a race where:
- The LockFileManager tries to own the lock file and fails.
- The other owner then releases and removes the lock file.
- The LockFileManager tries to read the owner info from the lock file but fails now.

In such a case have LockFileManager try to get ownership again, instead of error'ing out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 17:37:10 +00:00
Argyrios Kyrtzidis
7b95c0d529 [Support/LockFileManager] Use symbolic link for the lock file.
Hard links do not work on SMB network directories, and it causes us to fail
to build clang module files if the module cache is in such a directory.
rdar://15944959

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203137 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 17:37:04 +00:00
Argyrios Kyrtzidis
bd3f9c0b6b [Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203136 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 17:36:46 +00:00
Ahmed Charles
7284c9795a Add <cstddef> for use of std::ptrdiff_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203086 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 06:13:54 +00:00
Ahmed Charles
acc8fb158e Fix break by qualifying ptrdiff_t with std::.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203084 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 06:05:26 +00:00
Ahmed Charles
f4ccd11075 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 05:51:42 +00:00
Ben Langmuir
82d372e12b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202999 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 19:56:30 +00:00
Ahmed Charles
fbf6daaec6 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202959 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:27:34 +00:00
Ahmed Charles
1a6eca243f [C++11] Replace OwningPtr::take() with OwningPtr::release().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202957 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 10:19:29 +00:00
Ahmed Charles
c75dc7412b Remove unnecessary variables.
Found self-hosting clang-cl on windows. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202935 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 05:04:00 +00:00
Richard Smith
6e5887e7e6 Remove dependence on std::function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202902 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 22:13:07 +00:00
Richard Smith
943d1fdffe Add support for arbitrary functors to CrashRecoveryContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202895 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 21:48:49 +00:00
Benjamin Kramer
f0a0ceb034 APFloat: Add a move ctor and operator=
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202883 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 20:26:51 +00:00
Chandler Carruth
19d764fb05 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202838 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 12:24:34 +00:00
Craig Topper
4a655e7064 [C+11] Add 'override' keyword to methods in the support library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202791 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 06:24:11 +00:00
Benjamin Kramer
7515c71cb6 Revert "[C++11] Replace LLVM atomics with std::atomic."
Breaks the MSVC build.
DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202731 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 18:02:34 +00:00
Benjamin Kramer
4721e55a0c [C++11] Replace LLVM atomics with std::atomic.
With C++11 we finally have a standardized way to specify atomic operations. Use
them to replace the existing custom implemention. Sadly the translation is not
entirely trivial as std::atomic allows more fine-grained control over the
atomicity. I tried to preserve the old semantics as well as possible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202730 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 17:53:30 +00:00
Benjamin Kramer
a4f0aad951 [C++11] Replace llvm::tie with std::tie.
The old implementation is no longer needed in C++11.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202644 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 13:30:33 +00:00
Chandler Carruth
fc6d7d6cf5 [C++11] Replace LLVM_STATIC_ASSERT with static_assert, we now have
access to it on all host toolchains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202642 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 13:10:45 +00:00
Craig Topper
629b96cb4f Switch all uses of LLVM_OVERRIDE to just use 'override' directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-02 09:09: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
Benjamin Kramer
ee5e607355 Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.
No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 11:47:00 +00:00
Chandler Carruth
e56ffb951f [C++11] Remove the R-value reference #if usage from the ADT and Support
libraries. It is now always 1 in LLVM builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202580 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 09:27:28 +00:00
Mark Seaborn
79ac85be0b Fix RWMutex to be thread-safe when pthread_rwlock is not available
lib/Support/RWMutex.cpp contains an implementation of RWMutex that
uses pthread_rwlock, but when pthread_rwlock is not available (such as
under NaCl, when using newlib), it silently falls back to using the
no-op definition in lib/Support/Unix/RWMutex.inc, which is not
thread-safe.

Fix this case to be thread-safe by using a normal mutex.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202570 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 04:30:32 +00:00
Justin Bogner
4ef6a7bf69 CommandLine: Exit successfully for -version and -help
Tools that use the CommandLine library currently exit with an error
when invoked with -version or -help. This is unusual and non-standard,
so we'll fix them to exit successfully instead.

I don't expect that anyone relies on the current behaviour, so this
should be a fairly safe change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202530 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 19:08:01 +00:00
Alexander Kornienko
106a28c770 Re-apply r200853, which should not crash after Clang plugins were converted to loadable modules in r201256.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202404 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27 14:47:37 +00:00
Ben Langmuir
8a6c29ef5b Revert "Use StringRef in raw_fd_ostream constructor"
This reverts commit r202225, which may cause a performance regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202338 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27 02:09:10 +00:00
Eric Christopher
0115a4ef95 Remove unnecessary llvm:: qualification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202316 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 23:27:16 +00:00
NAKAMURA Takumi
18f2091b7b [CMake] BUILD_SHARED_LIBS: Fixup for r202261: Give PULIC to system_libs in LLVMSupport.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202263 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 12:18:55 +00:00
NAKAMURA Takumi
07f95b3218 [CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.
target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202241 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 06:53:16 +00:00
Ben Langmuir
ca302abd20 Use StringRef in raw_fd_ostream constructor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202225 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 03:21:00 +00:00
Rafael Espindola
ac69459e0f Replace the F_Binary flag with a F_Text one.
After this I will set the default back to F_None. The advantage is that
before this patch forgetting to set F_Binary would corrupt a file on windows.
Forgetting to set F_Text produces one that cannot be read in notepad, which
is a better failure mode :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202052 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 18:20:12 +00:00
Christian Pirker
d7e12561a5 Add AArch64 big endian Target (aarch64_be)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202024 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 11:34:50 +00:00
Rafael Espindola
69aeeee4e1 Share a createUniqueEntity implementation between unix and windows.
The only extra bit of functionality that had to be exposed for this be be
implemented in Path.cpp is opening a file in rw mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202005 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 03:07:41 +00:00
Rafael Espindola
6822655f56 Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 01:07:38 +00:00
Rafael Espindola
da6ffb33d2 Use static instead of an anonymous namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201983 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 15:16:03 +00:00
Rafael Espindola
589d637725 Simplify remove, create_directory and create_directories.
Before this patch they would take an boolean argument to say if the path
already existed. This was redundant with the returned error_code which is able
to represent that. This allowed for callers to incorrectly check only the
existed flag instead of first checking the error code.

Instead, pass in a boolean flag to say if the previous (non-)existence should be
an error or not.

Callers of the of the old simple versions are not affected. They still ignore
the previous (non-)existence as they did before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201979 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 13:56:14 +00:00
Rafael Espindola
e4e42f7ff8 Use simpler form of llvm::sys::fs::remove.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201975 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 13:37:37 +00:00
NAKAMURA Takumi
043cc54d6c Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries.  Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation.  CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.

We still need to build knowledge of system library dependencies into
'llvm-config'.  Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.

Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code.  Replace their implementations with a warning that explains
the calls are no longer necessary.  Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 06:27:04 +00:00
Logan Chien
3c288fc8e7 Don't inline get[S|U]LEB128Size() until they are proved to be hot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201939 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-22 15:39:39 +00:00