Commit Graph

2595 Commits

Author SHA1 Message Date
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
Michael J. Spencer
225d1f3c6a [Support] Correctly handle zero length inputs to UTF conversion functions on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201811 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-20 20:46:23 +00:00
Rafael Espindola
e08aac49ea Use mkdir instead of stat+mkdir.
This is an optimistic version of create_diretories: it tries to create the
directory first and looks at the parent only if that fails.

Running strace on "mkdir -p" shows that it is pessimistic, calling mkdir on
every element of the path. We could implement that if needed.

In any case, with both strategies there is no reason to call stat, just check
the return of mkdir.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201347 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 16:58:19 +00:00
Rafael Espindola
5d9d24daef Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 13:45:45 +00:00
Rafael Espindola
f79b906492 Use simpler version of sys::fs::exists when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201289 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 04:00:35 +00:00
Reid Kleckner
29a60e6deb Rename Windows.h to WindowsSupport.h to avoid ambiguity
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201258 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 21:26:20 +00:00
David Fang
17159cb158 _CS_DARWIN_USER macros available on darwin>=9. Thanks, Dave Odell!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201255 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 21:02:12 +00:00
NAKAMURA Takumi
f51d6eb340 Windows/Path.inc: Move <shlobj.h> after "Windows.h" for some API available.
I found that swapping the order of some header files helped fix a
  build issue that we're seeing on mingw32. Without the swap, windows.h
  was being included before _WIN32_WINNT was being defined and the
  CreateHardLinkW function was #ifdef'd out.

  It looks like the header is mainly used to get the SHGetFolderPathW
  function, so I don't think that there'll be much fallout from the
  switch.

Suggested by Alex Crichton. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201230 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 11:50:22 +00:00
Dmitri Gribenko
d4ab7d1b69 Remove TimeValue::toPosixTime() -- it is buggy, semantics are unclear, and its
only current user should be using toEpochTime() instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201136 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-11 09:11:18 +00:00
Aaron Ballman
bec3b4865e Using the helper API for random number generation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201125 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-11 03:40:14 +00:00
Aaron Ballman
91b585bccc Hopefully fixing the MinGW 32 build, which was broken by r200767. Not using rand_s() since MinGW does not have an implementation for it, but instead using the underlying CryptGenRandom APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201124 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-11 02:47:33 +00:00
NAKAMURA Takumi
fdc6308fa1 [CMake] LLVMSupport should be responsible to provide system_libs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201077 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 10:52:19 +00:00
Alexander Kornienko
11b8b43196 Fix an invalid check for duplicate option categories.
An intermediate solution until the problems with analyzer plugins linking with
llvm/Support and causing assertions due to duplicate GeneralCategory are solved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200981 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-07 17:42:30 +00:00
Benjamin Kramer
c3261b3120 Try to unbreak the mingw32 build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-07 12:05:36 +00:00
Rafael Espindola
9a7cfe5a3a Revert "Fix an invalid check for duplicate option categories."
This reverts commit r200853.

It was causing clang/Analysis/checker-plugins.c to crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200858 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 17:49:31 +00:00
Alexander Kornienko
0644c7a8ab Fix an invalid check for duplicate option categories.
Summary:
The check performed in the comparator is invalid, as some STL
implementations enforce strict weak ordering by calling the comparator with the
same value. This check was also in a wrong place: the assertion would only fire
when -help was used. The new check is performed each time the category is
registered (we are not going to have thousands of them, so it's fine to do it in
O(N^2)).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits, alexmc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200853 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 16:56:37 +00:00
Todd Fiala
9cd9208565 Fix configure to find arc4random via header files.
ISSUE:

On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a
transitive dependency of libedit. If a system had libedit on it that
was implemented in terms of libbsd.so, then the arc4random test,
previously implemented as a linker test, would succeed with -ledit.
However, on Ubuntu this would also require a #include <bsd/stdlib.h>.
This caused a build breakage on configure-based Ubuntu 12.04 with
libedit installed.

FIX:

This fix changes configure to test for arc4random by searching for it
in the standard header files. On Ubuntu 12.04, this test now properly
fails to find arc4random as it is not defined in the default header
locations. It also tweaks the #define names to match the output of the
header check command, which is slightly different than the linker
function check #defines.

I tested the following scenarios:

(1) Ubuntu 12.04 without the libedit package [did not find arc4random,
as expected]

(2) Ubuntu 12.04 with libedit package [properly did not find
arc4random, as expected]

(3) Ubuntu 12.04 with most recent libedit, custom built, and not
dependent on libbsd.so [properly did not find arc4random, as
expected].

(4) FreeBSD 10.0B1 [properly found arc4random, as expected]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200819 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 05:04:36 +00:00
Aaron Ballman
8753ba91d2 Implemented support for Process::GetRandomNumber on Windows.
Patch thanks to Stephan Tolksdorf!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200767 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-04 14:49:21 +00:00
Aaron Ballman
c2489e340e Undef'ing _WIN32_IE to silence an MSVC warning about redefining a macro value.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200704 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-03 17:20:26 +00:00
Chandler Carruth
e3f8794329 Rename the non-templated base class of SmallPtrSet to
'SmallPtrSetImplBase'. This more closely matches the organization of
SmallVector and should allow introducing a SmallPtrSetImpl which serves
the same purpose as SmallVectorImpl: isolating the element type from the
particular small size chosen. This in turn allows a lot of
simplification of APIs by not coding them against a specific small size
which is rarely needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200687 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-03 11:24:18 +00:00
Peter Collingbourne
69a0d80f55 Hopefully fix mingw32 bots.
For some reason this symbolic constant isn't defined in some versions of mingw32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200605 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-01 02:42:20 +00:00
Peter Collingbourne
bef2236283 Introduce llvm::sys::path::home_directory.
This will be used by the line editor library to derive a default path to
the history file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31 23:46:06 +00:00
Jordan Rose
c2d631000d [CommandLine] Aliases require an value if their target requires a value.
This can still be overridden by explicitly setting a value requirement on the
alias option, but by default it should be the same.

PR18649

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-29 18:54:17 +00:00
Mark Seaborn
11ecfc88eb Remove unnecessary call to pthread_mutexattr_setpshared()
The default value of this attribute is PTHREAD_PROCESS_PRIVATE, so
there's no point in calling pthread_mutexattr_setpshared() to set
that.

See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getpshared.html

This removes some ifdefs that tend to need to be extended for other
platforms (e.g. for NaCl).

Note that this call was in the first implementation of Mutex, added in
r22403, so it doesn't appear to have been added in response to a
performance problem.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200360 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-29 00:20:44 +00:00
Mark Seaborn
01df6842c1 Fix the "#ifndef HAVE_SYS_WAIT_H" code path in Program.inc to compile
Without this fix, WaitResult is not defined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-27 22:53:07 +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
Alp Toker
ae43cab6ba Fix known typos
Sweep the codebase for common typos. Includes some changes to visible function
names that were misspelt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200018 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-24 17:20:08 +00:00
David Woodhouse
70ece0ada7 [x86] Support i386-*-*-code16 triple for emitting 16-bit code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199648 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-20 12:02:25 +00:00