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

1322 Commits

Author SHA1 Message Date
Michael Gottesman
be2e357fd1 [cmake] Add support for using the standalone leaks sanitizer with LLVM.
This commit causes LLVM_USE_SANITIZER to now accept the "Leaks" option. This
will cause cmake to pass in -fsanitize=leak in all of the appropriate places.

I am making this change so that I can setup a linux bot that only detects
leaks.

llvm-svn: 305839
2017-06-20 20:28:07 +00:00
Vassil Vassilev
b1c3f2425a D33466: Make file non-executable.
llvm-svn: 305795
2017-06-20 14:20:48 +00:00
NAKAMURA Takumi
ad9505ab40 [CMake] Get rid of generating obj.*-tblgen if CMake >= 3.9 for Ninja generator.
CMake-3.9 doesn't let compilation units depend on their dependent libraries.

llvm-svn: 305635
2017-06-17 13:45:55 +00:00
NAKAMURA Takumi
e6ce8bcee4 [CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET_TRIPLE at runtime.
No behavior is changed if LLVM_TARGET_TRIPLE_ENV is blank or undefined.

If LLVM_TARGET_TRIPLE_ENV is "TEST_TARGET_TRIPLE" and $TEST_TARGET_TRIPLE is not blank,
llvm::sys::getDefaultTargetTriple() returns $TEST_TARGET_TRIPLE.
Lit resets config.target_triple and config.environment[LLVM_TARGET_TRIPLE_ENV] to change the default target.

Without changing LLVM_DEFAULT_TARGET_TRIPLE nor rebuilding, lit can be run;

  TEST_TARGET_TRIPLE=i686-pc-win32 bin/llvm-lit -sv path/to/test/
  TEST_TARGET_TRIPLE=i686-pc-win32 ninja check-clang-tools

Differential Revision: https://reviews.llvm.org/D33662

llvm-svn: 305632
2017-06-17 03:19:08 +00:00
Galina Kistanova
511fe48bfd Addressed Takumi's comment about redundancy.
llvm-svn: 305222
2017-06-12 19:17:55 +00:00
NAKAMURA Takumi
510c2060fc TableGen.cmake: Try to fix build breakage introduce in r305142.
LLVM_TABLEGEN_TARGET is undefined in clang standalone build.
STREQUAL cannot omit LHS. Then I saw an error;

  CMake Error at /path/to/install/llvm/lib/cmake/llvm/TableGen.cmake:40 (if):
      if given arguments:
        "STREQUAL" "/path/to/install/llvm/bin/llvm-tblgen.exe"
      Unknown arguments specified

llvm-svn: 305159
2017-06-11 00:57:30 +00:00
Galina Kistanova
bafaba0c14 Added dependency on the TableGen executable file.
For the case when LLVM_OPTIMIZED_TABLEGEN is ON (enables LLVM_USE_HOST_TOOLS),
we need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the  DEPENDS list
to have .inc files rebuilt on a tablegen change, as cmake does not propagate
file-level dependencies of custom targets.

We could always have just one dependency on both the target and
the file, but the 2 cases would produce cleaner cmake files.

llvm-svn: 305142
2017-06-10 07:48:49 +00:00
Vassil Vassilev
592c727a07 Enable c++1z experimental builds.
Patch by David Abdurachmanov!

llvm-svn: 305123
2017-06-09 22:09:57 +00:00
Mandeep Singh Grang
188048610f [cmake] Enable reverse iteration by default through build macro
Summary:
Reverse iteration can be turned on, by default, by setting -DLLVM_REVERSE_ITERATION:BOOL=ON during cmake.
With this enabled, we can uncover lots of cases of non-determinism in codegen by simply running our tests (without any other change).
We can then setup a buildbot which will have this turned on by default. Initially, a lot of unit tests will fail in this configuration.
Once we start fixing non-determinism issues, we can gradually make this a blocker for patches.

Reviewers: davide, dblaikie, mehdi_amini, dberlin

Reviewed By: dblaikie

Subscribers: probinson, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D33908

llvm-svn: 304757
2017-06-06 00:36:09 +00:00
Tom Stellard
4f9f35db65 CMake: Fix docs-llvm-man target when clang+llvm is in the same source tree
Summary:
This was broken by r302499.  Configuring with -DLLVM_BUILD_DOCS=ON would
cause the docs-llvm-man target not to be created.

Reviewers: anemet, beanz

Reviewed By: anemet

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D33146

llvm-svn: 303042
2017-05-15 09:34:23 +00:00
Tom Stellard
59a98b05ce Revert "Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake""
This reverts commit r302054.

Re-commit now that I have fixes for clang/lld.

llvm-svn: 302499
2017-05-09 01:41:28 +00:00
Tom Stellard
e15d6e93f5 Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake"
This reverts commit r302025.

clang and lld need to be updated too so they don't break with this patch.

llvm-svn: 302054
2017-05-03 17:22:23 +00:00
Tom Stellard
bc274a8acb CMake: Move sphinx detection into AddSphinxTarget.cmake
Reviewers: chandlerc, beanz, mgorny

Reviewed By: beanz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31773

llvm-svn: 302025
2017-05-03 14:29:56 +00:00
Tim Northover
efe8747147 CMake: Silence more stderr when running git.
It can confuse bots collecting errors.

llvm-svn: 301934
2017-05-02 16:37:37 +00:00
Bob Haarman
a06d21ff8f limit to 2 parallel links when using thinlto
Summary:
When using ThinLTO, the linker performs its own parallelism. This
change limits the number of parallel link jobs that Ninja will issue
to keep the total number of threads reasonable when linking with
ThinLTO.

Reviewers: hans, ruiu

Subscribers: mgorny, mehdi_amini, Prazek

Differential Revision: https://reviews.llvm.org/D31990

llvm-svn: 301676
2017-04-28 20:17:15 +00:00
Tim Northover
6524f22a0e CMake: ignore git stderr when trying to sort out revision. NFC.
llvm-svn: 301650
2017-04-28 16:06:00 +00:00
Nitesh Jain
e92b868df0 [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM.
Reviewers: beanz

Subscribers: jaydeep, bhushan, lldb-commits, slthakur, llvm-commits, krytarowski, emaste

Differential Revision: https://reviews.llvm.org/D32125

llvm-svn: 301171
2017-04-24 10:36:46 +00:00
Sylvestre Ledru
ea4b28cda6 Add a linker script to version LLVM symbols
Summary:
This patch adds a very simple linker script to version the lib's symbols
and thus trying to avoid crashes if an application loads two different
LLVM versions (as long as they do not share data between them).

Note that we deliberately *don't* make LLVM_5.0 depend on LLVM_4.0:
they're incompatible and the whole point of this patch is
to tell the linker that.


Avoid unexpected crashes when two LLVM versions are used in the same process.

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Author: Lisandro Damían Nicanor Pérez Meyer <lisandro@debian.org>
Author: Sylvestre Ledru <sylvestre@debian.org>
Bug-Debian:  https://bugs.debian.org/848368


Reviewers: beanz, rnk

Reviewed By: rnk

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D31524

llvm-svn: 300496
2017-04-17 20:51:50 +00:00
Ayman Musa
93c5e0808b Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
llvm-svn: 300185
2017-04-13 09:26:49 +00:00
Ayman Musa
fb33fa064c [X86] Change instructions names to keep consistency with the naming convention. NFC
Differential Revision: https://reviews.llvm.org/D31743

llvm-svn: 300184
2017-04-13 09:12:32 +00:00
Peter Collingbourne
1553cd1af6 Support: Add a VCSRevision.h header file.
This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

Differential Revision: https://reviews.llvm.org/D31985

llvm-svn: 300160
2017-04-13 01:26:12 +00:00
Vassil Vassilev
f54522eae6 Append -w when LLVM_ENABLE_WARNINGS is Off.
Reviewed by rnk (D31702)!

llvm-svn: 300100
2017-04-12 20:43:11 +00:00
Ed Maste
ea780becd1 Fix detection of backtrace() availability on FreeBSD
On FreeBSD backtrace is not part of libc and depends on libexecinfo
being available. Instead of using manual checks we can use the builtin
CMake module FindBacktrace.cmake to detect availability of backtrace()
in a portable way.

Patch By:	Alex Richardson
Differential Revision:	https://reviews.llvm.org/D27143

llvm-svn: 300062
2017-04-12 13:51:00 +00:00
Jonathan Roelofs
fdb54ce7e7 Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
This is a re-work of r297516, which was reverted in r297545.

https://reviews.llvm.org/D30906

llvm-svn: 299547
2017-04-05 14:49:46 +00:00
Serge Pavlov
4367811d11 Fix evaluation of LLVM_DEFINITIONS
CMake variable LLVM_DEFINITIONS collects preprocessor definitions provided
for host compiler that builds llvm components. A function
add_llvm_definitions was introduced in AddLLVMDefinitions.cmake to keep
track of these definitions and was intended to be a replacement for CMake
command add_definitions. Actually in many cases add_definitions is still
used and the content of LLVM_DEFINITIONS is not actual now. On the other
hand the current version of CMake allows getting set of definitions in a
more convenient way. This fix implements evaluation of the variable by
reading corresponding cmake property.

Differential Revision: https://reviews.llvm.org/D31125

llvm-svn: 298336
2017-03-21 04:03:24 +00:00
Reid Kleckner
60f04f6ae0 [cmake] Refactor warning flag logic to use Unix warnings with clang-cl
Summary:
clang-cl understands the GCC-style -W[no-]foo flags, and for the most
part ignores MSVC -wd flags. So, let's pass the curated set of warning
flags we use on Unix on Windows. We can also stop passing /W4 -wd*,
which for the most part corresponds to -Wall -Wextra with a bunch of
flags that we mostly ignore.

I had to disable -Wnon-virtual-dtor on Windows, because it fires on
every COM class ever. I filed PR32286 to fix this.

So far I've only found two instances of -Wstring-conversion in the
WinASan code, which I'll fix. Other than that we seem clean.

Reviewers: hans

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D30992

llvm-svn: 297964
2017-03-16 17:05:16 +00:00
Peter Collingbourne
d3ad65da26 Re-apply r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."
All known cache-related bugs observed when self hosting have been fixed (r296907
and r297853).

llvm-svn: 297854
2017-03-15 16:28:43 +00:00
Eric Fiselier
0d1cc3c255 Revert r297516 - Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
When CMAKE_INSTALL_MANDIR isn't defined it ends up attempting to install
the man pages under "/man1" and we really don't want to accidentally install
stuff at the filesystem root.

llvm-svn: 297545
2017-03-11 02:24:13 +00:00
Jonathan Roelofs
097d589869 Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
llvm-svn: 297516
2017-03-10 21:44:16 +00:00
Tom Stellard
18aa6f59ce CMake: Don't install llvm-tblgen twice
Summary:
The add_tablegen macros defines its own install target, and it was also calling
add_llvm_utility which adds another install target.

Configuring with -DLLVM_TOOLS_INSTALL_DIR set to something other than
'bin' along with -DLLVM_INSTALL_UTILS=ON was causing llvm-tablgen
to be installed to two separate directories.

Reviewers: beanz, hans

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30656

llvm-svn: 297403
2017-03-09 19:24:07 +00:00
Ayman Musa
5040c0050d [X86] Quick fix for build bot failure (r297127) due to unused variable.
llvm-svn: 297130
2017-03-07 08:56:27 +00:00
Ayman Musa
144efa4313 [X86][AVX512] Adding new LLVM TableGen backend which generates the EVEX2VEX compressing tables.
X86EvexToVex machine instruction pass compresses EVEX encoded instructions by replacing them with their identical VEX encoded instructions when possible.
It uses manually supported 2 large tables that map the EVEX instructions to their VEX ideticals.
This TableGen backend replaces the tables by automatically generating them.

Differential Revision: https://reviews.llvm.org/D30451

llvm-svn: 297127
2017-03-07 08:11:19 +00:00
Krzysztof Parzyszek
817f226056 Detect the existence of pthread_{s,g}etname_np in libpthread on Linux
Older Linux distributions may not have those functions.

llvm-svn: 296915
2017-03-03 21:53:12 +00:00
Peter Collingbourne
29cd52dc0c Revert r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."
Causes a build failure on the clang-with-thin-lto-ubuntu bot.
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2117/steps/build-stage3-compiler/logs/stdio

llvm-svn: 296850
2017-03-03 02:00:22 +00:00
Tom Stellard
b0fef6ac31 CMake: Clean up VersionFromVCS.cmake
Summary:
Fix a few problems in VersionFromVCS.cmake to make it more reliable:

- Stop using git svn info to retrieve the svn revision.  I am unable to
  determine what the svn revision returned by this command means.
  During my testing this command returned a revision from a month
  ago which was not the HEAD of any of my local branches.

  Also, this revision was never actually added to the version string due
  to a typo in the script.  All it was used for was to reject the
  revision number returned by git svn find-rev HEAD when the revision
  numbers didn't match.

- Populate GIT_COMMIT even when we detect a git repo without any
  svn information.

Reviewers: mehdi_amini, beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D30092

llvm-svn: 296829
2017-03-02 22:05:13 +00:00
Peter Collingbourne
41d9b0b540 cmake: Configure the ThinLTO cache directory when using ELF lld or gold.
Differential Revision: https://reviews.llvm.org/D30522

llvm-svn: 296730
2017-03-02 03:01:12 +00:00
Bob Haarman
a41054c917 enable building with LTO on Windows using clang-cl and lld
Summary: With clang-cl gaining support for link-time optimization, we can now enable builds using LTO when using clang-cl and lld on Windows. To do this, we must not pass the -flto flag to the linker; lld-link does not understand it, but will perform LTO automatically when it encounters bitcode files. We also don't pass /Brepro when using LTO - the compiler doesn't generate object files for LTO, so passing the flag would only result in a warning about it being unused.

Reviewers: rnk, ruiu, hans

Reviewed By: hans

Subscribers: mgorny, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D30240

llvm-svn: 296658
2017-03-01 19:22:18 +00:00
Michal Gorny
b85f17369e [Support] Provide linux/magic.h fallback for older kernels
The function for distinguishing local and remote files added in r295768
unconditionally uses linux/magic.h header to provide necessary
filesystem magic numbers. However, in kernel headers predating 2.6.18
the magic numbers are spread throughout multiple include files.
Furthermore, LLVM did not require kernel headers being installed so far.

To increase the portability across different versions of Linux kernel
and different Linux systems, add CMake header checks for linux/magic.h
and -- if it is missing -- the linux/nfs_fs.h and linux/smb.h headers
which contained the numbers previously.

Furthermore, since the numbers are static and the feature does not seem
critical enough to make LLVM require kernel headers at all, add fallback
constants for the case when none of the necessary headers is available.

Differential Revision: https://reviews.llvm.org/D30261

llvm-svn: 295854
2017-02-22 18:09:15 +00:00
Petr Hosek
8c29d6cecb [CMake] Support externalizing debug info on non-Darwin platforms
On other platorms, we use objcopy to export the debug info.

Differential Revision: https://reviews.llvm.org/D28575

llvm-svn: 295481
2017-02-17 19:29:12 +00:00
Chris Bieneman
cae2c4cca8 [CMake] Add variable IOS to iOS toolchain
This is useful for some edge cases where detecting things gets tricky. Specifically LLDB needs this to support iOS because CMake doesn't support running tests using obj-c code.

llvm-svn: 295392
2017-02-17 01:11:41 +00:00
Aditya Nandakumar
b5cce55dd5 [Tablegen] Instrumenting table gen DAGGenISelDAG
To help assist in debugging ISEL or to prioritize GlobalISel backend
work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
one which contains the patterns that are used during selection and the
other containing include source location of the patterns
Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV

llvm-svn: 295081
2017-02-14 18:32:41 +00:00
Matthias Braun
63a2ffaff0 config-ix.cmake: Search for CMAKE_XCRUN before using it.
This was previously searched in CMakeLists.txt unconditionally but as of
r294371 it is only searched in some circumstances. Repeating the search
in config-ix.cmake to make this robust and hopefully fix the macOS
Asan+Ubsan jenkins build.

llvm-svn: 294811
2017-02-11 00:14:01 +00:00
Eric Fiselier
db10580e9b [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Chris Bieneman
a0f94d3065 [CMake] Fix standalone project builds broken in r294514
This patch sets the global property indicating that target registration is complete for standalone sub-project builds.

llvm-svn: 294602
2017-02-09 18:14:12 +00:00
Chris Bieneman
8570a951d6 [CMake] Fix is_llvm_target_library and support out-of-order components
Summary: This patch is required by D28855, and enables us to rely on CMake's ability to handle out of order target dependencies.

Reviewers: mgorny, chapuni, bryant

Subscribers: llvm-commits, jgosnell

Differential Revision: https://reviews.llvm.org/D28869

llvm-svn: 294514
2017-02-08 20:58:37 +00:00
Eric Fiselier
7afb27af72 [CMake] Fix USE_LLVM_SANITIZER configuration for out-of-tree builds.
Summary:
r291918 changed `HandleLLVMOptions.cmake` to add `-fsanitize-blacklist=<llvm-file>` when `LLVM_USE_SANITIZER=Undefined` is specified. This breaks out-of-tree users of `LLVM_USE_SANITIZER` since that file is not present.

This patch fixes the issue by checking if the file exists first.

Reviewers: mgorny, bogner, vitalybuka, krasin

Reviewed By: krasin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29686

llvm-svn: 294367
2017-02-07 22:48:20 +00:00
Chris Bieneman
193c70a24d [CMake] Move ninja job pool options to HandleLLVMOptions
Moving the Ninja job pool configuration settings into the HandleLLVMOptions module will allow standalone builds of LLVM sub-projects to use the LLVM options without needing to re-implement them.

llvm-svn: 294334
2017-02-07 19:06:22 +00:00
Omair Javaid
34390864ad Fix LLDB Android AArch64 GCC debug info build
Committing after fixing suggested changes and tested release/debug builds on 
x86_64-linux and arm/aarch64 builds.

Differential revision: https://reviews.llvm.org/D29042

llvm-svn: 293850
2017-02-02 01:17:49 +00:00
Reid Kleckner
9ef8b5626d Remove LLVM_CONFIG from config headers
It appears to be dead, and it needlessly caused me to rebuild all of
LLVM when I changed CMAKE_INSTALL_PREFIX.

llvm-svn: 293574
2017-01-31 00:34:23 +00:00
Yichao Yu
43091afc08 CMake is funky on detecting Intel 17 as GCC compatible.
Summary: This adds a fallback in case that the Intel compiler is failed to be detected correctly.

Reviewers: chapuni

Reviewed By: chapuni

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D27610

llvm-svn: 293230
2017-01-26 23:50:18 +00:00
Justin Bogner
681793b361 cmake: Only sanitize use-after-scope if the host compiler supports it
In r292256, we started adding -fsanitize-use-after-scope when using
the address sanitizer, but that flag wasn't always available. This
fixes the config to only add the flag if the host compiler supports
it.

llvm-svn: 292423
2017-01-18 19:01:58 +00:00
Vitaly Buka
4eabe06f6d Enabled -fsanitize-address-use-after-scope for -DLLVM_USE_SANITIZER=Address
Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D28823

llvm-svn: 292256
2017-01-17 21:04:23 +00:00
Michal Gorny
b4924fa1d9 [cmake] Update SOVERSION for the new versioning scheme
Update SOVERSION to use just the major version number rather than
major+minor, to match the new versioning scheme where only major is used
to indicate API/ABI version.

Since two-digit SOVERSIONs were introduced post 3.9 branching, this
change does not risk any SOVERSION collisions. In the past,
two-component X.Y SOVERSIONs were shortly used but those will not
interfere with the new ones since the new versions start at 4.

Differential Revision: https://reviews.llvm.org/D28730

llvm-svn: 292255
2017-01-17 21:04:19 +00:00
Mehdi Amini
5fa6e09708 Add a LLVM_USE_LINKER that defines the linker to use when building LLVM
Summary:
This string parameter is passed to -fuse-ld when linking. It can be
an absolute path to your custom linker, otherwise clang will look for
`ld.{name}`.

Reviewers: davide, tejohnson, pcc

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D28738

llvm-svn: 292047
2017-01-15 03:21:30 +00:00
Ivan Krasin
dcd109a82d Fix UBSan bots by blacklisting bits/stl_tree.h.
Summary:
libstdc++ has some undefined behavior in bits/stl_tree.h that
has recently became excercised by some of the LLVM code.
Given that fixing libstdc++ will take years, adding the file
into a blacklist to fix bots seems like a necessity.

Reviewers: vitalybuka

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D28686

llvm-svn: 291918
2017-01-13 17:30:10 +00:00
Rui Ueyama
43a59ed7bc Add -Wl,-color-diagnostics if a linker supports the option.
Differential Revision: https://reviews.llvm.org/D28046

llvm-svn: 291719
2017-01-11 22:55:35 +00:00
Chandler Carruth
9b1fd10d77 Add the 'googlemock' component of Google Test to LLVM's unittest libraries.
I have two immediate motivations for adding this:
1) It makes writing expectations in tests *dramatically* easier. A
   quick example that is a taste of what is possible:

     std::vector<int> v = ...;
     EXPECT_THAT(v, UnorderedElementsAre(1, 2, 3));

   This checks that v contains '1', '2', and '3' in some order. There
   are a wealth of other helpful matchers like this. They tend to be
   highly generic and STL-friendly so they will in almost all cases work
   out of the box even on custom LLVM data structures.

   I actually find the matcher syntax substantially easier to read even
   for simple assertions:

     EXPECT_THAT(a, Eq(b));
     EXPECT_THAT(b, Ne(c));

   Both of these make it clear what is being *tested* and what is being
   *expected*. With `EXPECT_EQ` this is implicit (the LHS is expected,
   the RHS is tested) and often confusing. With `EXPECT_NE` it is just
   not clear. Even the failure error messages are superior with the
   matcher based expectations.

2) When testing any kind of generic code, you are continually defining
   dummy types with interfaces and then trying to check that the
   interfaces are manipulated in a particular way. This is actually what
   mocks are *good* for -- testing *interface interactions*. With
   generic code, there is often no "fake" or other object that can be
   used.

   For a concrete example of where this is currently causing significant
   pain, look at the pass manager unittests which are riddled with
   counters incremented when methods are called. All of these could be
   replaced with mocks. The result would be more effective at testing
   the code by having tighter constraints. It would be substantially
   more readable and maintainable when updating the code. And the error
   messages on failure would have substantially more information as
   mocks automatically record stack traces and other information *when
   the API is misused* instead of trying to diagnose it after the fact.

I expect that #1 will be the overwhelming majority of the uses of gmock,
but I think that is sufficient to justify having it. I would actually
like to update the coding standards to encourage the use of matchers
rather than any other form of `EXPECT_...` macros as they are IMO
a strict superset in terms of functionality and readability.

I think that #2 is relatively rarely useful, but there *are* cases where
it is useful. Historically, I think misuse of actual mocking as
described in #2 has led to resistance towards this framework. I am
actually sympathetic to this -- mocking can easily be overused. However
I think this is not a significant concern in LLVM. First and foremost,
LLVM has very careful and rare exposure of abstract interfaces or
dependency injection, which are the most prone to abuse with mocks. So
there are few opportunities to abuse them. Second, a large fraction of
LLVM's unittests are testing *generic code* where mocks actually make
tremendous sense. And gmock is well suited to building interfaces that
exercise generic libraries. Finally, I still think we should be willing
to have testing utilities in tree even if they should be used rarely. We
can use code review to help guide the usage here.

For a longer and more complete discussion of this, see the llvm-dev
thread here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108672.html

The general consensus seems that this is a reasonable direction to start
down, but that doesn't mean we should race ahead and use this
everywhere. I have one test that is blocked on this to land and that was
specifically used as an example. Before widespread adoption, I'm going
to work up some (brief) guidelines as some of these facilities should be
used sparingly and carefully.

Differential Revision: https://reviews.llvm.org/D28156

llvm-svn: 291606
2017-01-10 22:32:26 +00:00
Chandler Carruth
2570691977 [gtest] Detect warning flags using the positive spelling.
Some GCC versions will accept any warning flag name after a '-Wno-',
which would cause us to try to disable warnings with names GCC didn't
understand. This will silently succeed unless there is some other output
from GCC in which case we get weird cc1plus warnings about the warning
name being bogus.

There is still the issue that gtest sets warning flags for building
gtest-all.cc using weird 'add_definitions' and the fact that there is
a GCC version which warns on the variadic macro usage in gtest under
-pedantic, but has no flag analogous to Clang's
-Wgnu-zero-variadic-macro-argumnets to suppress this warning. I haven't
been able to come up with any good solution here. The closest is to turn
off -pedantic for those versions of GCC, but that seems really nasty.
For now, those versinos of GCC aren't warning clean. If anyone is broken
by this, I'll work on CMake logic to detect and disable -pedantic in
these cases.

llvm-svn: 291299
2017-01-06 23:16:00 +00:00
Michal Gorny
a44b476fd0 [cmake] Canonicalize CMake booleans to 0/1 for lit interop
Canonicalize all CMake booleans to 0/1 before passing them to lit, to
ensure that the Python side handles all of them consistently
and correctly. 0/1 is a safe choice of values that trigger the same
boolean interpretation in CMake, Python and C++.

Furthermore, using them without quotes improves the chance Python will
explicitly fail when an incorrect value (such as ON/OFF, TRUE/FALSE,
YES/NO) is accidentally passed, rather than silently misinterpreting
the value.

This replaces a lot of different logics spread around lit site files,
attempting to partially reproduce the boolean logic used in CMake
and usually silently failing when an uncommon value was used instead.
In fact, some of them were never working correctly since different
values were assigned in CMake and checked in Python.

The alternative solution could be to create a common parser for CMake
booleans in lit and use it consistently throughout the site files.
However, it does not seem like the best idea to create redundant
implementation of the same logic and have to follow upstream if it ever
is extended to handle more values.

Differential Revision: https://reviews.llvm.org/D28294

llvm-svn: 291284
2017-01-06 21:33:48 +00:00
Bob Wilson
1d524c0d0d Disable sigaltstack on Apple platforms
Using sigaltstack on Apple platforms is a bad idea. Darwin's backtrace()
function does not work with sigaltstack, and my change in r286851 was
supposed to solve that by using _Unwind_Backtrace instead. I tested that
_Unwind_Backtrace works for crashes but then discovered that it does not
work for assertion failures when using sigaltstack, at least on macOS.
The stack trace shows only the frames on the alternate stack.
I also saw some reports of this happening for crashes, but it fails
consistently for assertion failures. I tried various things to get it to
work but the problem seems to be in _Unwind_Backtrace itself. Disabling
sigaltstack is unfortunate since it would be nice to get backtraces for
stack overflows, but at least this gets us backtraces for the more common
cases. rdar://problem/29662459

llvm-svn: 291206
2017-01-06 02:26:30 +00:00
Chandler Carruth
8ae77dbc0f [gtest] Fix the way we disable a warning for unittests.
I somehow wrote this fix and then lost it prior to commit. Really sorry
about the noise. This should fix some issues with hacking add_definition
to do things with warning flags.

llvm-svn: 291033
2017-01-04 23:40:06 +00:00
Chandler Carruth
43eb155cf2 [gtest] Upgrade googletest to version 1.8.0, minimizing local changes.
This required re-working the streaming support and lit's support for
'--gtest_list_tests' but otherwise seems to be a clean upgrade.

Differential Revision: https://reviews.llvm.org/D28154

llvm-svn: 291029
2017-01-04 23:06:03 +00:00
Zachary Turner
2a893b4054 Fix the MSVC version check.
I'm not sure what determines the minor version, but it appears
that it's possible for a fully updated, release version of
VS2015 with Update 3 can go (at least) as low as 19.00.24213.1.
Updating the compiler version check to account for this so we
don't generate superfluous warnings.

llvm-svn: 290914
2017-01-03 23:12:36 +00:00
Michal Gorny
d561171bdd [cmake] Normalize LLVM_ENABLE_DIA_SDK to fix Windows tests
Attempts to fix Windows build breakage caused by r290818.

llvm-svn: 290832
2017-01-02 20:22:45 +00:00
Michal Gorny
f87de988a8 [cmake] Add LLVM_ENABLE_DIA_SDK option, and expose it in LLVMConfig
Add an explicit LLVM_ENABLE_DIA_SDK option to control building support
for DIA SDK-based debugging. Control its value to match whether DIA SDK
support was found and expose it in LLVMConfig (alike LLVM_ENABLE_ZLIB).

Its value is needed for LLDB to determine whether to run tests requiring
DIA support. Currently it is obtained from llvm/Config/config.h;
however, this file is not available for standalone builds. Following
this change, LLDB will be modified to use the value from LLVMConfig.

Differential Revision: https://reviews.llvm.org/D26255

llvm-svn: 290818
2017-01-02 18:19:35 +00:00
Chandler Carruth
c387751c70 Enable '-Wstring-conversion' and fix some bad asserts that it helped
find.

Notable is the assert in NewGVN which had no effect because of the bug.

llvm-svn: 290400
2016-12-23 01:38:06 +00:00
Reid Kleckner
ae6a0f0719 Pass -Wa,-mbig-obj in 64-bit mingw builds
COFF has a 2**16 section limit, and on Win64, every COMDAT function
creates at least 3 sections: .text, .pdata, and .xdata. For MSVC, we
enable bigobj on a file-by-file basis, but GCC appears to hit the limit
on different files.

Fixes PR25953

llvm-svn: 290358
2016-12-22 19:12:14 +00:00
Reid Kleckner
34418e533c Fix some remaining documentation references to MSVC 2013
MSVC 2015 has been the minimum supported version of VS since October.

Differential Revision: https://reviews.llvm.org/D25710

llvm-svn: 289854
2016-12-15 19:08:02 +00:00
Chris Bieneman
dfd2722185 [CMake] Minor change to symlink generation for LLDB
If OUTPUT_DIR is not specified we can assume the symlink is linking to a file in the same directory, so we can use $<TARGET_FILE_NAME:${target}> to create a relative symlink.

In the case of LLDB, when we build a framework, we are creating symlinks in a different directory than the file we're pointing to, and we don't install those links. To make this work in the build directory we can use $<TARGET_FILE:${target}> instead, which uses the full path to the target.

llvm-svn: 289840
2016-12-15 18:17:07 +00:00
Petr Hosek
1d3d64194c [CMake] Multi-target builtins build
This change enables building builtins for multiple different targets
using LLVM runtimes directory.

To specify the builtin targets to be built, use the LLVM_BUILTIN_TARGETS
variable, where the value is the list of targets.  To pass a per target
variable to the builtin build, you can set BUILTINS_<target>_<variable>
where <variable> will be passed to the builtin build for <target>.

Differential Revision: https://reviews.llvm.org/D26652

llvm-svn: 289491
2016-12-12 23:15:10 +00:00
Kostya Serebryany
12105334f9 [libFuzzer] switch all libFuzzer tests to use -fsanitize-coverage=trace-pc-guard. Support for the previosly used instrumentation will be removed in the following changes
llvm-svn: 289311
2016-12-10 02:26:23 +00:00
Reid Kleckner
aaac9636a8 Remove /Zc:sizedDealloc- from the MSVC build
According to the connect bug
(https://connect.microsoft.com/VisualStudio/feedback/details/1351894),
this was only necessary with pre-release versions of MSVC 2015.

Fixes PR23513

llvm-svn: 289257
2016-12-09 19:20:28 +00:00
Peter Collingbourne
0f18e6d6ae Re-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." with a configure-time check for lseek64.
llvm-svn: 289187
2016-12-09 05:20:43 +00:00
Chris Bieneman
98f9dd59fb [CMake] Add check for HAVE_CRASHREPORTER_INFO
This was also explicitly undef in CMake for some unknown reason.

Hopefully this one won't kill all the bots.

llvm-svn: 288977
2016-12-07 20:55:38 +00:00
Chris Bieneman
636fc9decc [CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H
The CMake build has been hardcoding this to undef forever, we shouldn't have been doing that.

llvm-svn: 288956
2016-12-07 18:53:04 +00:00
Chris Bieneman
c02aeaa9b8 [CMake] Fixing clang standalone build
I broke this in r288770.

llvm-svn: 288829
2016-12-06 17:09:29 +00:00
Chris Bieneman
2716b34915 [CMake] Cleanup TableGen include flags
It is kinda crazy to have llvm/include and llvm/lib/Target in the include path for every tablegen invocation for every tablegen-like tool.

This patch removes those flags from the tablgen function that is called everywhere by instead creating a variable LLVM_TABLEGEN_FLAGS which is setup in the LLVM source directories.

This removes TableGen.cmake's dependency on LLVM_MAIN_SRC_DIR, and LLVM_MAIN_INCLUDE_DIR.

llvm-svn: 288770
2016-12-06 04:45:11 +00:00
Chris Bieneman
1d03c031f7 [CMake] Fix symlink refactor for multi-configuration generators
This fix, while a bit complicated, preserves the reusability while fixing the issues reported on llvm-commits with visual studio generators.

llvm-svn: 288679
2016-12-05 17:02:11 +00:00
Michal Gorny
888fb64023 [cmake] Include component in Sphinx install rules
Include component in install rules for Sphinx targets. Based on
a similar suggestion for other doc targets in D24935.

Differential Revision: https://reviews.llvm.org/D24982

llvm-svn: 288656
2016-12-05 09:15:05 +00:00
Chris Bieneman
bf8065ca98 [CMake] Refactor add_llvm_tool_symlink for reuse
The old implementation of add_llvm_tool_symlink could fail in odd ways when building out of tree. This version solves that problem by not using the LLVM_* variables, and instead reaeding the target's properties.

llvm-svn: 288632
2016-12-05 03:28:03 +00:00
Saleem Abdulrasool
49e0347049 build: allow specifying the component to llvm_install_symlink
Add an optional parameter to `llvm_install_symlink` which allows the symlink
installation to be placed into a specific component rather than the default
value.

llvm-svn: 288600
2016-12-03 22:03:24 +00:00
Peter Collingbourne
1c65e3e9b2 cmake: Set rpath for loadable modules as well as shared libraries.
This fixes a regression introduced by r285714: we weren't setting the
rpath on LLVMgold.so correctly.

Spotted by mark@chromium.org!

Differential Revision: https://reviews.llvm.org/D27176

llvm-svn: 288076
2016-11-28 21:59:14 +00:00
Chris Bieneman
956c69a0f8 [CMake] Apply sandbox profile to target not directory
When LLVM_DEPENDENCY_DEBUGGING=On we should apply the sandbox only on the target, not the directory. This is important for directories that create more than one target, or for nested directories.

llvm-svn: 287415
2016-11-19 01:32:09 +00:00
Yichao Yu
7bcebdc718 Add an option to disable libedit
Summary: This should provide the function similar to `--disable-libedit` with the autotools build system, which seems to be missing from the commit (r200595) that adds this.

Reviewers: pcc, beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26550

llvm-svn: 287293
2016-11-18 01:25:49 +00:00
Petr Hosek
ad6bd42c19 [CMake] Error when LTO and lld are enabled on Darwin
lld on Darwin does not currently support LTO.

Differential Revision: https://reviews.llvm.org/D26715

llvm-svn: 287256
2016-11-17 20:22:49 +00:00
Pavel Labath
d1b5564292 [cmake] Move LLVM_BUILD_STATIC check to an earlier point
Summary:
The motivation for this is to enable correct detection of dlopen() on Android.
Android does not provide a static version of libdl, so if we add the -static flag
after performing the check, it will succeed even though subsequent link steps
will fail. With this change we correctly detect the absence of libdl in a
LLVM_BUILD_STATIC build on Android.

The link itself still does not succeed because the code does not check the result
of this check properly, but I plan to fix that in a separate change.

Reviewers: beanz

Subscribers: danalbert, mgorny, srhines, tberghammer, llvm-commits

Differential Revision: https://reviews.llvm.org/D26463

llvm-svn: 287220
2016-11-17 11:22:23 +00:00
Chris Bieneman
9dda0e2259 [CMake] [Darwin] Add support for debugging tablegen dependencies
This patch adds an option to the build system LLVM_DEPENDENCY_DEBUGGING. Over time I plan to extend this to do more complex verifications, but the initial patch causes compile errors wherever there is missing a dependency on intrinsics_gen.

Because intrinsics_gen is a compile-time dependency not a link-time dependency, everything that relies on the headers generated in intrinsics_gen needs an explicit dependency.

llvm-svn: 287207
2016-11-17 04:36:59 +00:00
Aaron Ballman
3ad0d1cfda Reverting r285406, which was a temporary workaround to get one of the documentation bots upgraded to something newer than GCC 4.7. This restores the check for GCC 4.8.
llvm-svn: 286822
2016-11-14 13:33:51 +00:00
Mehdi Amini
4ae83cd009 CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR
This is need because of clang-tblgen

Differential Revision: https://reviews.llvm.org/D26483

llvm-svn: 286560
2016-11-11 04:27:59 +00:00
Justin Bogner
9df9449c63 cmake: Don't try to install exports if there aren't any
When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

llvm-svn: 286209
2016-11-08 05:02:18 +00:00
Mandeep Singh Grang
e62d1ca0a9 [CMake] Fix llvm_setup_rpath function
Summary:
Set _install_rpath to CMAKE_INSTALL_RPATH if it is defined, so that eventually
INSTALL_RPATH is set to CMAKE_INSTALL_RPATH.
The "if(NOT DEFINED CMAKE_INSTALL_RPATH)" was missing a corresponding else
clause.
This also cleans up the fix made in r285908.

Patch by Azharuddin Mohammed

Reviewers: john.brawn, sgundapa, beanz

Subscribers: chapuni, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26289

llvm-svn: 286184
2016-11-08 00:45:05 +00:00
Justin Bogner
f0c30875e0 cmake: When using LLVM_DISTRIBUTION_COMPONENTS, adjust LLVMExports accordingly
This Makes sure we only export targets that we're distributing, since
cmake will fail to import the file otherwise due to missing targets.

llvm-svn: 286024
2016-11-04 21:55:23 +00:00
John Brawn
bdf7cc8cc2 [CMake] Make CMAKE_INSTALL_RPATH work again
r285714 made it so that when CMAKE_INSTALL_RPATH is set _install_rpath is not
set, but that means INSTALL_RPATH gets set to an empty string which isn't what
we want. Fix this by setting INSTALL_RPATH only when _install_rpath is set.

llvm-svn: 285908
2016-11-03 13:55:04 +00:00
Jonas Hahnfeld
c9c3a6dfea [CMake] Disable rpath for UnitTests
This was broken since rL285714.

Differential Revision: https://reviews.llvm.org/D26246

llvm-svn: 285881
2016-11-03 06:58:16 +00:00
Chris Bieneman
6454f88f98 [CMake] Fix rpath construction for out-of-tree builds
This patch was produced in conjunction with Michał Górny. It should resolve the issues that were trying to be solved by D25304.

This moves rpath handling into `llvm_add_library` and `add_llvm_executable` so that it is available to all projects using AddLLVM whether built in-tree or out-of-tree.

llvm-svn: 285714
2016-11-01 17:44:58 +00:00
Justin Bogner
5e2e245a64 cmake: Enable the lto cache when building with -flto=thin on darwin
llvm-svn: 285450
2016-10-28 20:48:47 +00:00
Teresa Johnson
7929c0b31d [cmake] Temporarily revert enforcement of minimum GCC version increase
Summary:
This is temporary, until bot that builds public facing LLVM
documentation is upgraded. It reverts only the cmake change in r284497,
but leaves the doc changes in place to preserve intent.

Reviewers: aaron.ballman

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26078

llvm-svn: 285406
2016-10-28 15:30:27 +00:00
Justin Bogner
1773e2c387 cmake: Make /usr/share/cmake installable with LLVM_DISTRIBUTION_COMPONENTS
Add a cmake-exports install component and appropriate targets for
LLVM_DISTRIBUTION_COMPONENTS to work with.

llvm-svn: 285030
2016-10-24 21:40:15 +00:00
Teresa Johnson
b21b115cce [docs] Increase minimum supported GCC version for building LLVM to 4.8
Summary:
The RFC proposal sent to increase the minimum required GCC version
to 4.8 received a lot of support. See the following thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/105955.html,

This patch implements that by updating the docs. I believe the
references to libstdc++ 4.7 issues can be removed as well, please
let me know if that is not the case or if they should be updated
a different way.

Reviewers: rengolin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25683

llvm-svn: 284497
2016-10-18 17:17:37 +00:00
Michal Gorny
0e3582c71e [cmake] Make LIT_COMMAND configurable and improve fallback support
Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

Differential Revision: https://reviews.llvm.org/D25076

llvm-svn: 283247
2016-10-04 20:25:37 +00:00
Chris Bieneman
09d40ae011 [CMake] Exclude intrinsics_gen from LLVM_COMMON_DEPENDS in LLVMConfig.cmake
CMake requires that all targets expressed as dependencies exist, so we can't have intrinsics_gen in LLVM_COMMON_DEPENDS when it is written out, otherwise projects building out of tree will have CMake errors.

llvm-svn: 283234
2016-10-04 17:44:28 +00:00
Michal Gorny
fb59389817 [cmake] Reintroduce (ldconfig-compatible) SOVERSIONs on shared libraries
Reintroduce versioning of shared libraries via SOVERSION, addressing
the issues with the previous design, since Gentoo is relying
on shared-split install of LLVM. The SOVERSIONs were originally
introduced in r229720 for all libraries, and removed in r252093 in favor
of custom SONAME. As far as I understand, the major concern with the old
versioning was that the used versions were incompatible with ldconfig.

Having considered that, this commit introduce SOVERSIONS with the
following considerations:

1. SOVERSIONs are formed of major & minor version concatenated -- i.e.
for 4.0 its .so.40. This matches the common practice where the first
version number indicates ABI breakage, and therefore fixes the issues
with ldconfig. Additionally, VERSION with the remaining verion
components appended is used, however this is not strictly necessary.

2. The versioning is only applied to libraries with no explicit SONAME
specified -- i.e. it won't apply to libLLVM but only to the split
libraries. It will also apply to libraries installed by the subprojects.

3. The versioning is only done on *nix systems, Darwin excluded. This
matches the current use of SONAME.

Differential Revision: https://reviews.llvm.org/D24757

llvm-svn: 283189
2016-10-04 06:09:18 +00:00
Michal Gorny
738be959dd [cmake] Use separate doctrees to prevent races between Sphinx instances
Use separate doctrees between different Sphinx builders in order to
prevent race condition issues due to multiple Sphinx instances accessing
the same doctree cache in parallel.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23781

Differential Revision: https://reviews.llvm.org/D23755

llvm-svn: 283188
2016-10-04 06:09:14 +00:00
Michal Gorny
45b39d124f Revert r283029 - [cmake] Make LIT_COMMAND configurable and improve fallback support
Revert the change in r283029 (and the fixup in r283033) due to buildbot
breakage. The fixup is ineffective for the bots that do not force clean
build since the wrong value is already cached in CMakeCache.txt.

Reverting it should result in the cache variable being removed
and therefore it should be possible to re-introduce it after all
buildbots build this revision.

llvm-svn: 283036
2016-10-01 13:15:56 +00:00
Michal Gorny
e0e6b48575 [cmake] Fix incorrect default for LIT_COMMAND, from r283029
llvm-svn: 283033
2016-10-01 10:56:58 +00:00
Michal Gorny
38f9c9240a [cmake] Make LIT_COMMAND configurable and improve fallback support
Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

Differential Revision: https://reviews.llvm.org/D25076

llvm-svn: 283029
2016-10-01 09:28:05 +00:00
Michal Gorny
01e7483e2e [OCaml] Install .mli (interface) files
Install the OCaml interface .mli files. Those files were most likely
omitted because they are input files for the compiled .cmi files.
However, installing them is reasonable since -- unlike .cmi files --
they are human-readable.

The issue was originally spotted by @jpdeplaix.

Differential Revision: https://reviews.llvm.org/D25128

llvm-svn: 283028
2016-10-01 09:26:23 +00:00
Joerg Sonnenberger
d74ea32fab GC HAVE_STRTOQ
llvm-svn: 283023
2016-10-01 07:35:08 +00:00
Michal Gorny
51dd7d27dc cmake: Install the OCaml libraries into a more correct path
Add a OCAML_INSTALL_PATH variable that can be used to control
the install path for OCaml libraries. The new variable defaults to
${OCAML_STDLIB_PATH}, i.e. the OCaml library path obtained from
the OCaml compiler. Install libraries into "llvm" subdirectory.

This fixes two issues:

1. OCaml library directories differ between systems, and 'lib/ocaml' is
incorrect e.g. on amd64 Gentoo where OCaml is installed
in 'lib64/ocaml'. Therefore, obtain the library path from the OCaml
compiler using 'ocamlc -where' (which is already used to set
OCAML_STDLIB_PATH), which is the method used commonly in OCaml packages.

2. The top-level directory is reserved for the standard library, and has
precedence over local directory in search path. As a result, OCaml
preferred the files installed along with previous LLVM version over the
source tree when building a new version, resulting in two versions being
mixed during the build. The new layout is used commonly by other OCaml
packages, and findlib is able to find the LLVM libraries successfully.

Bug: https://bugs.gentoo.org/559134
Bug: https://bugs.gentoo.org/559624

Differential Revision: https://reviews.llvm.org/D24354

llvm-svn: 282895
2016-09-30 18:34:23 +00:00
Petr Hosek
4f8f123c96 [CMake] Support symlinks even with LLVM_INSTALL_TOOLCHAIN_ONLY
When LLVM_INSTALL_TOOLCHAIN_ONLY is used and LLVM_TOOLCHAIN_TOOLS
contains a tool which is a symlink, it would be ignored. This already
worked before but got broken in r282510.

Differential Revision: https://reviews.llvm.org/D25067

llvm-svn: 282844
2016-09-30 06:29:28 +00:00
Joerg Sonnenberger
1da18e65b3 GC HAVE_DLERROR.
llvm-svn: 282780
2016-09-29 21:32:30 +00:00
Joerg Sonnenberger
8b77a8502e GC srand48/lrand48/drand48.
llvm-svn: 282779
2016-09-29 21:31:54 +00:00
Joerg Sonnenberger
4094bb2329 GC opendir/readdir/closedir checks.
llvm-svn: 282776
2016-09-29 21:29:57 +00:00
Joerg Sonnenberger
1b77ccf7a5 GC HAVE_SETJMP_H and checks for the content of setjmp.h.
llvm-svn: 282775
2016-09-29 21:28:37 +00:00
Joerg Sonnenberger
15c10a93f1 Check for sysconf(3).
llvm-svn: 282772
2016-09-29 21:18:05 +00:00
Joerg Sonnenberger
89ca5b90ce GC HAVE_MACH_O_DYLD_H.
llvm-svn: 282771
2016-09-29 21:15:57 +00:00
Joerg Sonnenberger
539f3d22ed GC HAVE_UTIME_H.
llvm-svn: 282770
2016-09-29 21:15:23 +00:00
Joerg Sonnenberger
1fe54c8d61 GC HAVE_LIMITS_H.
llvm-svn: 282769
2016-09-29 21:14:34 +00:00
Joerg Sonnenberger
5be6ce6f69 HAVE_UNWIND_BACKTRACE -> HAVE__UNWIND_BACKTRACE
Check for existance and not truth value.

llvm-svn: 282767
2016-09-29 21:07:57 +00:00
Vassil Vassilev
acf2d9e28c [modules] Centralize the module cache.
This reduces the build size from 17G to 1.9G on my machine.

llvm-svn: 282704
2016-09-29 08:14:06 +00:00
Chris Bieneman
4853b82d35 Improve CMake output of host and target triple
Summary:
The previous output was confusing as it would output "Taget triple:
x86_64-unknown-linux-gnu" even when LLVM_HOST_TRIPLE or
LLVM_DEFAULT_TARGET_TRIPLE were set on the CMake command line

Patch by: Alex Richardson!

Reviewers: beanz

Subscribers: Eugene.Zelenko

Differential Revision: https://reviews.llvm.org/D17067

llvm-svn: 282516
2016-09-27 18:08:40 +00:00
Chris Bieneman
0004923bda [CMake] Use if(... IN_LIST ...) instead of list(FIND...)
NFC. This is just a little code cleanup to make things easier to read and understand.

llvm-svn: 282510
2016-09-27 17:47:24 +00:00
Michal Gorny
718c216c41 cmake: Support overriding Sphinx HTML doc install directory
Provide ${PROJECT}_INSTALL_SPHINX_HTML_DIR variables (e.g.
LLVM_INSTALL_SPHINX_HTML_DIR) to override Sphinx HTML doc install
directory.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23780

Differential Revision: https://reviews.llvm.org/D23757

llvm-svn: 282240
2016-09-23 11:09:33 +00:00
Etienne Bergeron
eaf5e9d8ab fix typo in comment [NFC]
llvm-svn: 282091
2016-09-21 17:15:23 +00:00
Chris Bieneman
8478fdd5dd [CMake] Support symlinks with the same name as the binary
This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

llvm-svn: 281788
2016-09-16 22:19:19 +00:00
Derek Schuff
56b449af0f Install libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY
Summary:
When LLVM_LINK_LLVM_DYLIB is set, the libLLVM shared
library needs to be installed in the toolchain.  Without
this chanage LLVM_INSTALL_TOOLCHAIN_ONLY combined with
LLVM_LINK_LLVM_DYLIB results in a broken install.

Patch by Sam Clegg

Differential Revision: https://reviews.llvm.org/D24676

llvm-svn: 281763
2016-09-16 18:50:39 +00:00
Michael Gottesman
3aad9342d7 [cmake] Fix a stale comment from an earlier version of r281085. NFC.
llvm-svn: 281086
2016-09-09 19:48:22 +00:00
Michael Gottesman
9087caae4d [cmake] Export gtest/gtest_main and its dependencies via a special build tree only cmake exports file.
Previously, gtest/gtest_main were not exported via cmake. The intention here was
to ensure that users whom are linking against the LLVM install tree would not
get the gtest/gtest_main targets. This prevents downstream projects that link
against the LLVM build tree (i.e. Swift) from getting this dependency
information in their cmake builds. Without such dependency information, linker
issues can result on linux due to LLVMSupport being put before gtest on the
linker command line.

This commit preserves behavior that we want for the install tree, while adding
support for the build tree by:

1. The special casing for gtest/gtest_main in the add_llvm_library code is
removed in favor of a flag called "BUILDTREE_ONLY". If this is set, then the
library is communicating that it is only meant to be exported into the build
tree and is not meant to be installed or exported via the install tree. This
part is just a tweak to remove the special case, the underlying code is the
same.

2. The cmake code that exports cmake targets for the build tree has special code
to import an additional targets file called
LLVMBuildTreeOnlyExports.cmake. Additionally the extra targets are added to the
LLVMConfig.cmake's LLVM_EXPORTED_TARGETS variable. In contrast, the
"installation" cmake file uses the normal LLVM_EXPORTS_TARGETS as before and
does not include the extra exports file. This is implemented by
defining/undefining variables when performing a configure of the build/install
tree LLVMConfig.cmake files.

llvm-svn: 281085
2016-09-09 19:45:34 +00:00
Aaron Ballman
198204b8e7 Move the ocaml_all target into the Misc folder for cleanliness; NFC.
llvm-svn: 281061
2016-09-09 17:30:59 +00:00
Chris Bieneman
bcf9eddb6b [CMake] Cleanup LLVM_OPTIMIZED_TABLEGEN
This cleanup removes the need for the native support library to have its own target. That target was only needed because makefile builds were tripping over each other if two tablegen targets were building at the same time. This causes problems because the parallel make invocations through CMake can't communicate with each other. This is fixed by invoking make directly instead of through CMake which is how we handle this in External Project invocations.

The other part of the cleanup is to mark the custom commands as USES_TERMINAL. This is a bit of a hack, but we need to ensure that Ninja generators don't invoke multiple tablegen targets in the same build dir in parallel, because that too would be bad.

Marking as USES_TERMINAL does have some downside for Ninja because it results in decreased parallelism, but correct builds are worth the minor loss and LLVM_OPTIMZIED_TABLEGEN is such a huge win, it is worth it.

llvm-svn: 280748
2016-09-06 20:27:07 +00:00
Rafael Espindola
95cefc8ba1 Add an c++ itanium demangler to llvm.
This adds a copy of the demangler in libcxxabi.

The code also has no dependencies on anything else in LLVM. To enforce
that I added it as another library. That way a BUILD_SHARED_LIBS will
fail if anyone adds an use of StringRef for example.

The no llvm dependency combined with the fact that this has to build
on linux, OS X and Windows required a few changes to the code. In
particular:

    No constexpr.
    No alignas

On OS X at least this library has only one global symbol:
__ZN4llvm16itanium_demangleEPKcPcPmPi

My current plan is:

    Commit something like this
    Change lld to use it
    Change lldb to use it as the fallback

    Add a few #ifdefs so that exactly the same file can be used in
    libcxxabi to export abi::__cxa_demangle.

Once the fast demangler in lldb can handle any names this
implementation can be replaced with it and we will have the one true
demangler.

llvm-svn: 280732
2016-09-06 19:16:48 +00:00
Peter Zotov
faa562f2ae [CMake] [OCaml] Allow building OCaml bindings out of tree.
That is, add build system support for building the OCaml bindings
against preinstalled LLVM libraries. This is important for package
managers such as OPAM, because OCaml libraries need to be built
against a specific OCaml compiler installation.

llvm-svn: 280642
2016-09-05 01:42:22 +00:00
Chris Bieneman
6bb874314b [CMake] Revive LLVM_*_DIRS variables
This is a partial revert of r280013. Brad King pointed out these variable names are matching CMake conventions, so we should preserve them.

I've also added a direct mapping of the LLVM_*_DIR variables which we need to make projects support building in and out of tree.

llvm-svn: 280380
2016-09-01 16:43:39 +00:00
Andrey Bokhanko
930b1b4784 [CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC
Patch by Johannes Sebastian Mueller-Roemer.

Differential Revision: https://reviews.llvm.org/D23645

llvm-svn: 280371
2016-09-01 14:39:54 +00:00
NAKAMURA Takumi
cb63cfad3e [CMake] Increase stack size to 16MiB for all mingw executables.
llvm-svn: 280303
2016-08-31 22:43:23 +00:00
Chris Bieneman
616b6eef0d [CMake] Make LLVMConfig.cmake variable names match in-tree names
With the runtimes build we're trying to use LLVMConfig.cmake as a way of providing LLVM_* variables that are needed to behave as if the project is building in tree. To make this work we need to rename two variables by dropping the "S" from the end. This makes the variables match the in-tree names.

This renames:
LLVM_INCLUDE_DIRS -> LLVM_INCLUDE_DIR
LLVM_LIBRARY_DIRS -> LLVM_LIBRARY_DIR

The versions ending in S are not used in-tree anywhere. This also cleans up LLVM_LIBRARY_DIR being set to the same value with and without the "S".

llvm-svn: 280013
2016-08-29 21:26:32 +00:00
Chris Bieneman
da6e8b3dc0 cmake: Install CheckAtomic.cmake (needed by lldb)
Summary:
Install CheckAtomic.cmake along with other LLVM modules, therefore making it possible for other projects to use it. This file is needed for LLDB to be built standalone, and installing it was suggested in https://reviews.llvm.org/D23881.

Patch by: Michał Górny

Reviewers: krytarowski, zturner, eugenis, jyknight, labath, beanz

Subscribers: beanz, llvm-commits

Differential Revision: https://reviews.llvm.org/D23887

llvm-svn: 279777
2016-08-25 20:53:00 +00:00
Vitaly Buka
0f32658a09 Fixed comment
llvm-svn: 279718
2016-08-25 03:44:36 +00:00
Vitaly Buka
84f8ed03ef [asan] Disable CreateSigAltStack from Unix/Signals.inc for asan builds
Summary: Asan fails to UnsetAlternateSignalStack if it set by Unix/Signals.inc

Reviewers: kcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23864

llvm-svn: 279717
2016-08-25 03:32:49 +00:00
Chandler Carruth
b458b5cb8b [CMake/ASan] Skip using libedit if ASan is enabled -- it leaks memory.
Note that you'll have to clear this variable from your CMake cache for
it to take effect.

llvm-svn: 279362
2016-08-20 07:05:13 +00:00
Chris Bieneman
6dfd57cdfc [CMake] Make llvm-config implicit dependency for subprojects
The subproject interface being used for runtime libraries expects that llvm-config is passed into the subproject for consumption. We currently do this for every subproject, so we should expect that all LLVM ExternalProjects depend on llvm-config for the time being.

Eventually I'd like to see the sub-projects using LLVMConfig.cmake instead of the llvm-config binary, but that will take time to roll out.

llvm-svn: 279155
2016-08-18 21:41:21 +00:00
Jonas Hahnfeld
432bf8f81d Remove LLVM_ENABLE_LIBCXXABI
libc++.so is now a linker script that includes -lc++abi if necessary.

Differential Revision: https://reviews.llvm.org/D22861

llvm-svn: 277714
2016-08-04 10:24:48 +00:00
Eugene Zelenko
aef9df0c15 Add LLVM_ENABLE_LLD option to use LLD as C/C++ linker.
Differential revision: https://reviews.llvm.org/D22896

llvm-svn: 277093
2016-07-29 00:46:13 +00:00
Andrew Wilkins
4a2b09a26c [llvm-go] parameterize $GOPATH construction
Summary:
To build llgo, you must currently ensure that llgo
is in the tools/llgo directory, due to a hard-coded
path in llvm-go.

To support the use of LLVM_EXTERNAL_LLGO_SOURCE_DIR,
we introduce a flag to llvm-go that enables the
caller to specify the paths to symlink in the
temporary $GOPATH.

Reviewers: pcc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D21634

llvm-svn: 276829
2016-07-27 03:21:51 +00:00
Bruno Cardoso Lopes
e4279b249c [CMAKE] Find ld64 using xcrun
Given similar reasons from r276710, ld64 scrubs DYLD_* environment if
called from the shim executable /usr/bin/ld.

Add support for finding ld64 via xcrun.

This is needed in order to get LIT to have the full path to the ld4
executable.

Differential Revision: https://reviews.llvm.org/D22791

rdar://problem/24300926

llvm-svn: 276781
2016-07-26 18:09:23 +00:00
Justin Bogner
c5e9eef5d6 cmake: When adding lit testsuites, ignore Output directories
With in-tree builds we can get Output directories scattered among our
tests. Recursing into those to find tests doesn't make sense.

Thanks to nlewycky for noticing this!

llvm-svn: 276667
2016-07-25 18:07:14 +00:00
Chandler Carruth
93b744cf6b Add AIX support to Path.inc, Host.h, and CMake.
Patch by Andrew Paprocki!

Differential Revision: https://reviews.llvm.org/D18359

llvm-svn: 276045
2016-07-19 22:46:39 +00:00
Rafael Espindola
2037c03682 Use posix_fallocate instead of ftruncate.
This makes sure that space is actually available. With this change
running lld on a full file system causes it to exit with

failed to open foo: No space left on device

instead of crashing with a sigbus.

llvm-svn: 276017
2016-07-19 20:19:56 +00:00
Michael Gottesman
a1e74f182b [cmake] Create the LLVM_BUILD_UTILS option.
This option is the equivalent option to LLVM_BUILD_TOOLS but for executables
created via add_llvm_utility.

This is a useful tool for improving compile time in situations where LLVM is
used as a library and no testing tools are needed.

It follows the exact same implemention model as LLVM_BUILD_TOOLS.

Since the option is by default set to on, no behavior is changed unless one sets
it from the command line to be false.

llvm-svn: 275007
2016-07-10 02:43:47 +00:00
John Brawn
917b4ac3e1 [CMake] Adjust export_executable_symbols to cope with non-target link libraries
export_executable_symbols looks though the link libraries of the executable in
order to figure out transitive dependencies, but in doing so it assumes that
all link libraries are also targets. This is not true as of r273302, so adjust
it to check if they actually are targets.

llvm-svn: 274546
2016-07-05 13:16:54 +00:00
John Brawn
10ceed9ad4 [CMake] Add LLVM_BUILD_32_BITS to LLVMConfig.cmake
Previously out-of-tree passes could detect if LLVM was built with
LLVM_BUILD_32_BITS by looking for -m32 in LLVM_DEFINITIONS, but as of r271871
it no longer appears there. Resolve this by instead emitting LLVM_BUILD_32_BITS
in LLVMConfig so it can be checked for directly.

Differential Revision: http://reviews.llvm.org/D21434

llvm-svn: 274351
2016-07-01 14:22:52 +00:00
Adrian Prantl
a0611feb1f [CMake] Add an LLVM_ENABLE_MODULE_DEBUGGING flag for building with -gmodules.
This flag is only effective in builds with debug info and modules.
The default is On for Darwin only.

rdar://problem/27019000

llvm-svn: 274244
2016-06-30 17:15:44 +00:00
Adrian Prantl
c47b447e60 Revert "[CMake] Move the -Xclang option before -fmodules-cache-path"
This reverts commit 3db82f646a0890eb7664d0351b5a3c79622e8bef.

Vassil already fixed this and I mechanically undid his fix without looking
too close at what I'm actually doing. Need more coffee.

llvm-svn: 274242
2016-06-30 15:58:36 +00:00
Adrian Prantl
394a78928c [CMake] Move the -Xclang option before -fmodules-cache-path
This fixes a typo introduced in r274196.
Thanks to Vassil Vassilev for noticing!

http://reviews.llvm.org/D21827
rdar://problem/27019000

llvm-svn: 274240
2016-06-30 15:44:35 +00:00
Vassil Vassilev
4ebe903f96 [CMake] -fmodules-local-submodule-visibility is a cc1-only option.
This should fix modules builds on platforms other than Darwin after r274196.

llvm-svn: 274227
2016-06-30 14:17:42 +00:00
Adrian Prantl
18577887ec [CMake] Introduce a LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY flag.
On Darwin it is currently impossible to build LLVM with modules
because the Darwin system module map is not compatible with
-fmodules-local-submodule-visibility at this point in time.  This
patch makes the flag optional and off by default on Darwin so it
becomes possible to build LLVM with modules again.

http://reviews.llvm.org/D21827
rdar://problem/27019000

llvm-svn: 274196
2016-06-30 01:46:49 +00:00
Michael Gottesman
e3b79e69c7 [LLVMConfig.cmake] LLVM_CONFIG_EXPORTED_TARGETS => LLVM_EXPORTED_TARGETS.
This matches more closely the rest of the variables in LLVMConfig.cmake which
shed the _CONFIG_ part of their names.

llvm-svn: 274175
2016-06-29 21:58:15 +00:00
Michael Gottesman
e1d501b2af [LLVMConfig.cmake.in] Create a new variable LLVM_CONFIG_EXPORTED_TARGETS that contains the list of all targets exported via LLVMExports.cmake.
llvm-svn: 274140
2016-06-29 17:32:37 +00:00
Michael Gottesman
751d2dc853 [cmake] Port the llvm-config option --build-mode to LLVMConfig.cmake via the variable LLVM_BUILD_TYPE.
This is just a small step in the direction of making LLVMConfig.cmake a complete
replacement for llvm-config.

For those unfamiliar, llvm-config --build-mode prints out CMAKE_BUILD_TYPE. Thus
as one can imagine, LLVM_BUILD_TYPE is @CMAKE_BUILD_TYPE@.

llvm-svn: 273782
2016-06-25 11:31:50 +00:00
Chris Bieneman
3fe6b38cf2 [CMake] Add LLVM runtimes directory
Summary:
There are a few LLVM projects that produce runtime libraries. Ideally
runtime libraries should be built differently than other projects,
specifically they should be built using the just-built toolchain.

There is support for building compiler-rt in this way from the clang
build. Moving this logic into the LLVM build is interesting because it
provides a simpler way to extend the just-built toolchain to include
LLD and the LLVM object file tools.

Once this functionality is better fleshed out and tested we’ll want to
encapsulate it in a module that can be used for clang standalone
builds, and we’ll want to make it the default way to build compiler-rt.

With this patch applied there is no immediate change in the build.
Moving compiler-rt out from llvm/projects into llvm/runtimes enables
the functionality.

This code has a few improvements over the method provided by
LLVM_BUILD_EXTERNAL_COMPILER_RT. Specifically the sub-ninja command is
always invoked, so changes to compiler-rt source files will get built
properly, so this patch can be used for iterative development with
just-built tools.

This first patch only works with compiler-rt. Support for other
runtime projects will be coming in follow-up patches.

Reviewers: chandlerc, bogner

Subscribers: kubabrecka, llvm-commits

Differential Revision: http://reviews.llvm.org/D20992

llvm-svn: 273620
2016-06-23 22:07:21 +00:00
Aaron Ballman
3202ec0278 Default to using the Unicode version of Win32 APIs instead of the ANSI version. This helps to catch instances where a developer accidentally forgets to explicitly specify which version of the API to use and accidentally winds up failing to support non-ASCII characters properly.
llvm-svn: 273599
2016-06-23 19:02:09 +00:00
Sagar Thakur
a4a97086ee [LLVM][MIPS] Introduce 64 bit atomic check in CheckAtomic.cmake
Patch by Nitesh Jain.

Summary: On some target like MIPS32 we need to explicitly link atomic library for 64 bit atomic operations. This module then can be used in LLDB (http://reviews.llvm.org/D20464) or Libcxx (http://reviews.llvm.org/D16613) for explicitly link to atomic library.

Reviewers: chandlerc, beanz
Differential: reviews.llvm.org/D20896
llvm-svn: 273534
2016-06-23 06:39:35 +00:00
Chris Bieneman
7decd11bd4 [CMake] LLVM_BINARY_DIR was not being properly set in LLVMConfig.cmake
LLVMConfig.cmake needs to set LLVM_BINARY_DIR differently based on whether or not it is the build directory or the install directory. The build directory just needs to set the value from the configuration, the install directory needs to set it to the install prefix.

llvm-svn: 273479
2016-06-22 21:01:19 +00:00
Artem Belevich
ae4eccabfc [build] Fixed build break for OCaml bindings.
After r273302 LLVM_SYSTEM_LIBS may have entries that already have
-l prefix and we need to deal with that.

llvm-svn: 273333
2016-06-21 23:10:37 +00:00
Artem Belevich
c49d776c67 [build] Make sure to link main executable with pthreads
Otherwise it gets linked in by one of the dependencies of shared
libraries which may be too late and we end up with weird crashes in
std::call_once().

Differential Revision: http://reviews.llvm.org/D21478

llvm-svn: 273302
2016-06-21 19:34:40 +00:00
Vedant Kumar
c6b8569cc2 Add support for collating profiles for use with code coverage
Differential Revision: http://reviews.llvm.org/D20993

llvm-svn: 272599
2016-06-13 23:33:48 +00:00
Vassil Vassilev
1872258b31 [CMake] Allow LLVM to be embedded and built in a subfolder as part of another project.
Patch by Bertrand Bellenot!

Reviewed by Chris Bieneman and me.

llvm-svn: 272481
2016-06-11 17:20:53 +00:00
Chris Bieneman
5e3b2f93ed [CMake] Removing fallback code for CMake versions before 3.1
This code is dead code now. Out with the old, in with the new!

llvm-svn: 272347
2016-06-09 23:53:22 +00:00
Chris Bieneman
0158e53ab5 [CMake] Cleanup ExternalProject usage of CMake 3.x features
All the ExternalProject features in use here are supported by CMake 3.4.3, so we don't need these version checks anymore.

llvm-svn: 272327
2016-06-09 22:41:36 +00:00
Chris Bieneman
ca114f3116 [CMake] Add LLVM_TOOLS_INSTALL_DIR to LLVMConfig.cmake
This is the more-correct fix to out-of-tree building. AddLLVM.cmake relies on this variable being set, so we should make sure it is set in LLVMConfig.cmake.

llvm-svn: 272279
2016-06-09 17:22:02 +00:00
Chris Bieneman
a52559bdef [CMake] Cleanup version check for 2.8.11
We are always greater than CMake 2.8.11, so we don't need this check.

llvm-svn: 272220
2016-06-08 22:48:12 +00:00
Chris Bieneman
aa7dda9b81 [CMake] Cleanup version check for 2.8.12
Since we're always greater than 2.8.12, we don't need this check anymore.

llvm-svn: 272219
2016-06-08 22:48:01 +00:00
Justin Bogner
849952e84e cmake: Simplify add_lit_testsuites
cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be
used to simplify this code greatly.

llvm-svn: 272217
2016-06-08 22:36:37 +00:00
Chris Bieneman
746ef5229c [CMake] Cleanup uses of USES_TERMINAL
Now that we are on CMake 3.4.3 we no longer need a version check around this.

llvm-svn: 272211
2016-06-08 22:19:25 +00:00
Chris Bieneman
b6385a607e [CMake] Fixing a typo
This was called out on the list a long time ago and just got pointed out to me again. Need to fix it before I forget.

llvm-svn: 272201
2016-06-08 21:22:03 +00:00
Chris Bieneman
b087e27002 [CMake] Support overriding binary install directory
This patch adds a new option LLVM_TOOLS_INSTALL_DIR which allows customizing the location executables and symlinks get installed to. This adds the functionality provided by autoconf's --bindir flag.

This patch is based on patches from and collaboration with Tony Kelman, and replaces http://reviews.llvm.org/D20934.

llvm-svn: 272200
2016-06-08 21:19:26 +00:00
Chris Bieneman
2b0d6027c2 Revert "Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths"
This reverts commit 0dc5a55f66ed06d7859c4e0474a87428d27775e6.

llvm-svn: 272033
2016-06-07 18:04:37 +00:00
Chris Bieneman
9fbb86b419 Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths
Summary:
This allows customizing the location executables and symlinks get installed to,
as with --bindir in autotools.

Reviewers: loladiro, beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20934

llvm-svn: 272031
2016-06-07 18:01:16 +00:00
NAKAMURA Takumi
311ae9cc2f LLVM_BUILD_32_BITS: Add -m32 with CMAKE_C*_FLAGS. [CMP0056]
With CMP0056, try_compile() uses also CMAKE_EXE_LINKER_FLAG.
It caused mismatch between CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS, to fail to examine CXX_SUPPORTS_CXX11 with -m32.

FYI, before this, try_compile() tries without -m32 regardless of LLVM_BUILD_32_BITS.

llvm-svn: 271871
2016-06-06 05:54:55 +00:00
Justin Bogner
fc9b621e7a cmake: Fix color diags under ninja if the compiler is "AppleClang"
Apparently cmake differentiates between Clang and AppleClang, and we
fail to color our diagnostics if you have the latter. Fix that.

llvm-svn: 271442
2016-06-01 23:29:26 +00:00
Ismail Donmez
98307fb038 Since some time clang itself figures out the default for ms-compatibility-version and uses it. Trying to figure it out during build is redundant and also will not work when the environment variable VSINSTALLDIR is not defined (which is not defined if you don't install whole Visual Studio but use Visual C++ Build Tools package).
Tested by bootstrapping clang with clang-cl.

Differential Revision: http://reviews.llvm.org/D20672

llvm-svn: 270860
2016-05-26 15:52:23 +00:00
John Brawn
af398354eb Add auto-exporting of symbols from tools so that plugins work on Windows
The problem with plugins on Windows is that when building a plugin DLL it needs
to explicitly link against something (an exe or DLL) if it uses symbols from
that thing, and that thing must explicitly export those symbols. Also there's a
limit of 65535 symbols that can be exported. This means that currently plugins
only work on Windows when using BUILD_SHARED_LIBS, and that doesn't work with
MSVC.

This patch adds an LLVM_EXPORT_SYMBOLS_FOR_PLUGINS option, which when enabled
automatically exports from all LLVM tools the symbols that a plugin could want
to use so that a plugin can link against a tool directly. Plugins can specify
what tool they link against by using PLUGIN_TOOL argument to llvm_add_library.
The option can also be enabled on Linux, though there all it should do is
restrict the set of symbols that are exported as by default all symbols are
exported.

This option is currently OFF by default, as while I've verified that it works
with MSVC, linux gcc, and cygwin gcc, I haven't tried mingw gcc and I have no
idea what will happen on OSX. Also unfortunately we can't turn on
LLVM_ENABLE_PLUGINS when the option is ON as bugpoint-passes needs to be
loaded by both bugpoint.exe and opt.exe which is incompatible with this
approach. Also currently clang plugins don't work with this approach, which
will be fixed in future patches.

Differential Revision: http://reviews.llvm.org/D18826

llvm-svn: 270839
2016-05-26 11:16:43 +00:00
Steven Wu
2a3de303da Revert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"
This reverts r270723. This commit breaks greendragon.

llvm-svn: 270820
2016-05-26 04:35:35 +00:00
Chris Bieneman
2b1c02aa22 [CMake] LINK_LIBS need to be public for Darwin dylib targets
This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib.

llvm-svn: 270723
2016-05-25 17:08:43 +00:00
Kevin Enderby
b9ab4d056f Add the printing the Mach-O (__LLVM,__bundle) xar archive file section "verbosely"
to llvm-objdump. This section is created with -fembed-bitcode option.

This requires the use of libxar and the Cmake and lit support were crafted by
Chris Bieneman!

rdar://26202242

llvm-svn: 270491
2016-05-23 21:34:12 +00:00
Richard Smith
74e8540951 Add a configure-time check for the existence of sigaltstack. It seems that some
systems provide a <signal.h> that doesn't declare it.

llvm-svn: 270278
2016-05-20 21:26:00 +00:00
Richard Smith
d86d870067 Reinstate r269992 (reverting r270267), but restricted to cases where glibc is
the C standard library implementation in use.

This works around a glibc bug in the backtrace() function where it fails to
produce a backtrace on x86_64 if libgcc / libunwind is statically linked.

llvm-svn: 270276
2016-05-20 21:18:12 +00:00
Chris Bieneman
681d988432 Revert "Work around a glibc bug: backtrace() spuriously fails if..."
This commit has been breaking the FreeBSD bots:
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd

This reverts commit r269992.

llvm-svn: 270267
2016-05-20 20:15:17 +00:00
Richard Smith
b9f1b721c1 Work around a glibc bug: backtrace() spuriously fails if
- glibc is dynamically linked, and
 - libgcc_s is unavailable (for instance, another library is being used to
   provide the compiler runtime or libgcc is statically linked), and
 - the target is x86_64.

If we run backtrace() and it fails to find any stack frames, try using
_Unwind_Backtrace instead if available.

llvm-svn: 269992
2016-05-18 22:26:36 +00:00
Chris Bieneman
07ab4cac09 [CMake] Add some extra variables to LLVMConfig.cmake.in
Compiler-RT needs LLVM_LIBRARY_DIR, LLVM_BINARY_DIR.

Setting these in LLVMConfig.cmake will allow Compiler-RT to not need to run llvm-config as long as the LLVMConfig.cmake module is in the CMake module path.

llvm-svn: 269104
2016-05-10 19:45:17 +00:00
Justin Bogner
9040306a47 cmake: Avoid continue, apparently that's new
llvm-svn: 268812
2016-05-06 22:22:25 +00:00
Justin Bogner
6d6bd1c06e CMake: generate check targets for lit suites without their own lit.cfgs
Currently our cmake generates targets like check-llvm-unit and
check-llvm-transforms-loopunroll-x86, but not check-llvm-transforms or
check-llvm-transforms-adce. This is because the search for test suites
only lists the ones with a custom lit.cfg or lit.local.cfg.

Instead, we can do something a little smarter - any directory under
test that isn't called Inputs or inside a directory called Inputs is a
test suite.

llvm-svn: 268806
2016-05-06 21:57:30 +00:00
Chris Bieneman
64aa95c1c8 Remove LLVM_ENABLE_TIMESTAMPS
Summary:
As per the discussion on LLVM-dev this patch proposes removing LLVM_ENABLE_TIMESTAMPS.

The only complicated bit of this patch is the Windows support. On windows we used to log an error if /INCREMENTAL was passed to the linker when timestamps were disabled.

With this change since timestamps in code are always disabled we will always compile on windows with /Brepro unless /INCREMENTAL is specified, and we will log a warning when /INCREMENTAL is specified to notify the user that the build will be non-deterministic.

See: http://lists.llvm.org/pipermail/llvm-dev/2016-May/098990.html

Reviewers: bogner, silvas, rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19892

llvm-svn: 268670
2016-05-05 19:57:03 +00:00
Filipe Cabecinhas
c8ae081a57 Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.
Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

Differential Revision: http://reviews.llvm.org/D19723

llvm-svn: 268050
2016-04-29 15:22:48 +00:00
Tobias Grosser
70a99e369b cmake: Fix grammar
llvm-svn: 268038
2016-04-29 13:03:40 +00:00
Richard Smith
8417406355 When building with LLVM_ENABLE_MODULES, put the module cache into the build
directory. This is important for build bots to avoid filling up /tmp.

llvm-svn: 266571
2016-04-17 20:58:01 +00:00
Mehdi Amini
5e6f018471 Add SVN version to libLLVMLTO
Summary: For Incremental LTO, we need to make sure that an old
cache entry is not used when incrementally re-linking with a new
libLTO.
Adding a global LLVM_REVISION in llvm-config.h would for to
rebuild/relink the world for every "git pull"/"svn update".
So instead only libLTO is made dependent on the VCS and will
be rebuilt (and the dependent binaries relinked, i.e. as of
today: libLTO.dylib and llvm-lto).

Reviewers: beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D18987

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266523
2016-04-16 07:33:14 +00:00
Alex Denisov
9fcc64726a Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

## Autogenerated by LLVM/Clang configuration.
# Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from 
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266515
2016-04-16 06:47:41 +00:00
Richard Smith
c8f9cc971a Update and fix LLVM_ENABLE_MODULES:
1) We need to add this flag prior to adding any other, in case the user has
specified a -fmodule-cache-path= flag in their custom CXXFLAGS. Such a flag
causes -Werror builds to fail, and thus all config checks fail, until we add
the corresponding -fmodules flag. The modules selfhost bot does this, for
instance.

2) Delete module maps that were putting .cpp files into modules.

3) Enable -fmodules-local-submodule-visibility, to get proper module
visibility rules applied across submodules of the same module. Disable
-fmodules for C builds, since that flag is not available there.

llvm-svn: 266502
2016-04-16 00:48:58 +00:00
Chris Bieneman
918b321130 [CMake] Make llvm_ExternalProject always call the build action
This makes it so that when running 'ninja test-suite' from the top-level LLVM ninja build it *always* re-runs the ninja command in the test-suite directory.

This mechanism is required because the top-level ninja file doesn't have a view into the subdirectory dependency tree, so it can't know what, if anything, needs to be rebuilt.

llvm-svn: 265863
2016-04-08 22:46:04 +00:00
Jeroen Ketema
c27156c4e1 [CMake] Check for sys/types.h in config-ix.cmake
`sys/types.h` has a related define in `config.h.cmake`, but was never
checked for in CMake. Sync this.

Differential Revision: http://reviews.llvm.org/D18825

llvm-svn: 265648
2016-04-07 08:36:13 +00:00
Chris Bieneman
df715f714d [CMake] Provide the ability to skip stripping when generating dSYMs
For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On.

llvm-svn: 265041
2016-03-31 20:03:19 +00:00
Reid Kleckner
2045f67567 [cmake] Instead of testing char16_t for MSVC compat, directly ask cl.exe its version
Credit to Aaron Ballman for thinking of this.

llvm-svn: 264886
2016-03-30 18:19:39 +00:00
Reid Kleckner
353c55531c [cmake] Add -fms-compatibility-version=19 when clang-cl gives errors about char16_t
What we are really trying to do here is to figure out if we are using
the 2015 STL. Unfortunately, so far as I know the MSVC STL does not
define a version macro that we can check directly. Instead I wrote a
check to see if char16_t works.

llvm-svn: 264881
2016-03-30 17:30:26 +00:00
Reid Kleckner
33b2ba219f [cmake] Allow EH usage with clang-cl
llvm-svn: 264880
2016-03-30 17:28:21 +00:00
Saleem Abdulrasool
55a643e94a cmake: include what you use
Add a missing include.  This is important in the case HandleLLVMOptions is
included prior to the missing CheckCXXSourceCompiles or CheckCXXCompilerFlag
which includes CheckCXXSourceCompiles.

llvm-svn: 262949
2016-03-08 18:56:00 +00:00
Chris Bieneman
4c05063985 [CMake] Refactor add_llvm_implicit_projects to be reusable
This adds llvm_add_implicit_projects which takes a project name and is wrapped by add_llvm_implicit_projects.

llvm-svn: 262948
2016-03-08 18:43:28 +00:00
NAKAMURA Takumi
6a76c59fc3 Revert r130657, "Windows/DynamicLibrary.inc: Clean up ELM_Callback. We may check the decl instead of the versions of individual libraries."
We may assume the type of 1st argument as PCSTR in PENUMLOADED_MODULES_CALLBACK. PSTR was in the ancient mingw32.

llvm-svn: 262810
2016-03-07 00:13:09 +00:00
Reid Kleckner
9feb4e3a93 [cmake] Check the compiler version first
Otherwise users get messages from CheckAtomic about missing libatomic
instead of a sensible message that says "use GCC 4.7 or newer".

I structured the change along the lines of HandleLLVMStdlib.cmake, so
that the standalone build of Clang still gets the compiler version
check.

Reviewers: beanz

Differential Revision: http://reviews.llvm.org/D17789

llvm-svn: 262491
2016-03-02 16:42:56 +00:00
Rafael Espindola
c165498992 Refactor duplicated code for linking with pthread.
llvm-svn: 262344
2016-03-01 15:54:40 +00:00
Renato Golin
b62da81886 [CMAKE] Update build on recent Haiku
This patch updates cmake build scripts to build on Haiku. It adds Haiku x86_64 to config.guess.
Please consider reviewing.

Pathc by Jérôme Duval.

llvm-svn: 262038
2016-02-26 17:01:45 +00:00
Justin Bogner
dec93a4fca cmake: Simplify the iOS.cmake toolchain
- Remove a comment that was clearly copy pasted from Android.cmake and
  isn't relevant.
- Remove the toolchain's sensitivity to the environment. It's less
  error prone to just allow users to set CMAKE_OSX_SYSROOT if they
  want to use a custom SDK.
- Stop explicitly setting -mios-version-min to the default value. It
  just adds needless complexity.

This makes building the native tablegen work for me even when SDKROOT
is set in the environment (or passed in as -DCMAKE_OSX_SYSROOT).

llvm-svn: 260763
2016-02-12 23:36:05 +00:00
Andrew Wilkins
fb2090fa73 Avoid linking LLVM component libraries with libLLVM
Patch by Jack Howarth.

When linking to libLLVM, don't also link to the component
libraries that constitute libLLVM.

Differential Revision: http://reviews.llvm.org/D16945

llvm-svn: 260641
2016-02-12 01:42:43 +00:00
Reid Kleckner
0249db6d41 Disable MSVC 2015's warning about zero extending after ~ and others
Very often in LLVM we have APIs that take a bitwidth and a uint64_t that
we pass immediates such as ~0U to. Consider APInt, Constant, and
MachineInstrBuilder::addImm. Fixing all uses of these APIs to manually
extend their arguments to uint64_t doesn't seem worth it.

llvm-svn: 260416
2016-02-10 19:25:51 +00:00
Reid Kleckner
30549aa2c3 Revert "Turn on LLVM_ENABLE_PLUGINS by default on Windows"
This reverts r260262, it broke some LLVM tests (bugpoint).

llvm-svn: 260339
2016-02-10 01:06:37 +00:00
Ehsan Akhgari
cfc837ef51 Turn on LLVM_ENABLE_PLUGINS by default on Windows
Reviewers: rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16760

llvm-svn: 260262
2016-02-09 19:37:27 +00:00
Justin Bogner
edbd3d1ae7 cmake: Use "set" instead of "option" for LLVM_ENABLE_LTO
Apparently option is for bools and cmake-gui will display this
strangely with option.

Pointed out by edward-san - thanks!

llvm-svn: 260154
2016-02-08 21:55:19 +00:00
Justin Bogner
974dab4e8f cmake: Accept "thin" or "full" as arguments to -DLLVM_ENABLE_LTO
Mehdi suggested in a review of r259766 that it's also useful to easily
set the type of LTO. Augment the cmake variable to support that.

llvm-svn: 260143
2016-02-08 21:01:24 +00:00
Niels Ole Salscheider
a0cd125976 Install cmake files to lib/cmake/llvm
This is the right location for platform-specific files.

On some distributions (e. g. Exherbo), a package can be installed for several
architectures in parallel, but the architecture-independent files are shared.
Therefore, we must not install architecture-dependent files (like the CMake
config and export files) to share/.

llvm-svn: 259821
2016-02-04 20:08:19 +00:00
Justin Bogner
d393294b5b cmake: Add a flag to enable LTO
This adds -DLLVM_ENABLE_LTO, rather than forcing people to manually
add -flto to the various _FLAGS variables.

llvm-svn: 259766
2016-02-04 07:28:30 +00:00
Chris Bieneman
1b8d4f74aa Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16471

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Aaron Ballman
aabad88851 Reapplying r256836 with a fix for MSVC 14 support.
Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.

Patch by Alexander Riccio

llvm-svn: 258687
2016-01-25 14:17:39 +00:00
Reid Kleckner
b68cad5bbe [cmake] Disable manifest generation when LLD is the linker
Running mt.exe to make the manifest is really slow. Disabling manifest
generation doesn't seem to break anything.

llvm-svn: 258581
2016-01-22 23:27:13 +00:00
Owen Anderson
28c07122cf Strip local symbols when using externalized debug info.
When we build LLVM with externalized debug info, all debugging and
symbolication related data is extracted into dSYM files prior to
stripping. As such, there is no need to preserve local symbols in LLVM
binaries after dSYM creation.

This shrinks libLLVM.dylib from 58MB to 55MB on my system.

llvm-svn: 258566
2016-01-22 22:07:24 +00:00
Andrew Wilkins
e690f5b8b2 tools/llvm-config: improve shared library support
Summary:

This is a re-commit of r257003, which was reverted,
along with the fixes from http://reviews.llvm.org/D15986.

r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15986

llvm-svn: 258283
2016-01-20 04:03:09 +00:00
Nico Weber
31b01d59cc Reenable -Wexpansion-to-defined.
I think I fixed all instances of this in the codebase
(r258202, 258200, 258190).  Also, the suppression didn't
have an effect on bots using make anyways, and it looks
like many bots still use configure/make bots.

llvm-svn: 258210
2016-01-19 22:46:33 +00:00
Nico Weber
70c6fe4d8d Fix bootstrap -Werror builds after clang r258128
llvm-svn: 258181
2016-01-19 20:52:17 +00:00
Geoff Berry
40581de42f [cmake] Fix add_version_info_from_vcs git svn version bug.
Summary:
add_version_info_from_vcs was setting SVN_REVISION to the last fetched
svn revision when using git svn instead of the svn revision
corresponding to HEAD.  This leads to conflicts with the definition of
SVN_REVISION in SVNVersion.inc generated by GetSVN.cmake when HEAD is
not the most recently fetched svn revision.

Use 'git svn info' to determine SVN_REVISION when git svn is being used
instead (as is done in GetSVN.cmake).

Reviewers: beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16299

llvm-svn: 258148
2016-01-19 17:36:02 +00:00
Chris Bieneman
499dd6ea19 [CMake] Need to install VersionFromVCS.cmake as part of LLVM's CMake modules
This is required to support clang --version detecting the clang repository information.

llvm-svn: 257909
2016-01-15 17:49:46 +00:00
NAKAMURA Takumi
0ff6f8a2a4 [autoconf] Install VersionFromVCS.cmake, too. clang/CMakeLists.txt requires it.
llvm-svn: 257856
2016-01-15 02:13:04 +00:00
Chris Bieneman
2de1f4cb59 [CMake] Add support for populating LLVM_REPOSITORY from CMake.
Autoconf does this in the GetRepositoryPath script, CMake's VersionFromVCS does grab the SVN_REVISION, but doesn't populate the repository URL.

llvm-svn: 257826
2016-01-14 22:44:29 +00:00
Axel Naumann
04fcf95002 Explicitly enable OBJECT library "target".
With this, one can build a lib from the objects of other libs:
set(SOURCES
  $<TARGET_OBJECTS:obj.clingInterpreter>
  $<TARGET_OBJECTS:obj.clingMetaProcessor>
  $<TARGET_OBJECTS:obj.clingUtils>
  )

Reviewed by Chris Bieneman - thanks!

llvm-svn: 257459
2016-01-12 07:44:58 +00:00
Andrew Wilkins
a734d141fe Revert r257003
This revision breaks llvm-config if you set
BUILD_SHARED_LIBS=on in a CMake build. Backing
out until the fix is ready to land.

llvm-svn: 257457
2016-01-12 07:23:58 +00:00
Andrew Wilkins
51a57d89a6 tools/llvm-config: improve shared library support
Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15033

llvm-svn: 257003
2016-01-07 00:18:56 +00:00
Nico Weber
f2a28338f0 Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS
LLVM_ENABLE_TIMESTAMPS controls if timestamps are embedded into llvm's
binaries. Turning it off is useful for deterministic builds.

r246905 made it so that the define suddenly also controls if the binaries that
the llvm binaries _create_ embed timestamps or not – but this shouldn't be a
configure-time option. r256203/r256204 added a driver option to toggle this on
and off, so this patch now passes this driver option in LLVM_ENABLE_TIMESTAMPS
builds so that if LLVM_ENABLE_TIMESTAMPS is set, the build of LLVM is
deterministic – but the built clang can still write timestamps into other
executables when requested.

This also allows removing some of the test machinery added in r292012 to work
around this problem.

See PR24740 for background.
http://reviews.llvm.org/D15783

llvm-svn: 256958
2016-01-06 19:05:19 +00:00
Aaron Ballman
0e898e92c4 Reverting r256836; it causes a build bot failure: http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/14050/steps/build/logs/stdio
llvm-svn: 256837
2016-01-05 14:35:01 +00:00
Aaron Ballman
a446e7a779 Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.
Patch by Alexander Riccio

llvm-svn: 256836
2016-01-05 14:24:01 +00:00
Nico Weber
4d29f9cae5 win: Pass /W4 in front of all the -wd flags.
This should fix many many -Wunused-parameter warnings in self-host builds on
Windows after r255382.  cl.exe doesn't care about the order of /W4 and
/wd flags, but clang-cl currently does (just like -Wno-foo -Wall order
matters for clang).  We might want to change how clang-cl behaves in
the future, but until then this change makes self-host builds much more
silent.

llvm-svn: 256315
2015-12-23 02:38:31 +00:00
Andy Gibbs
d9ba2c9d06 Revert r254592 (virtual dtor in SCEVPredicate).
Clang has better diagnostics in this case.  It is not necessary therefore
to change the destructor to avoid what is effectively an invalid warning
in gcc.  Instead, better handle the warning flags given to the compiler.

llvm-svn: 255905
2015-12-17 16:43:53 +00:00
Sumanth Gundapaneni
947a2bf7c3 Install runtime dlls in the INSTALL_DIR/bin directory. NFC
One of the earlier patches updated the cmake rule to install the
runtime dlls in INSTALL_DIR/lib which is not correct. This patch
updates the rule to install CMake's RUNTIME in bin directory
Differential Revision: http://reviews.llvm.org/D15505

llvm-svn: 255781
2015-12-16 17:07:15 +00:00
Chris Bieneman
28da4411df [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr-generate
This is the first step in supporting PGO data generation via CMake. I've marked the option as advanced and experimental until it is fleshed out further.

llvm-svn: 255298
2015-12-10 21:19:07 +00:00
Chris Bieneman
b9a96af62d [CMake] Ignore externalizing debuginfo for unit tests
If you externalize debug info for unit tests the test runner finds the mach-o inside the dsym bundle and tries to execute it as a test.

llvm-svn: 255056
2015-12-08 21:51:48 +00:00
Aaron Ballman
96865a146b Silence all C4592 warnings with MSVC 2015 Update 1. This warning produces false positives that Microsoft says will be fixed in Update 2. Until this produces reliable diagnostics, it is safe to disable the diagnostic -- the compiler is not doing anything different than it previously did aside from issuing the diagnostic.
(Note, this silences at least one false positive in LLVM with FeatureBitset uses.)

llvm-svn: 254915
2015-12-07 15:44:34 +00:00
Chris Bieneman
3c356b4f56 [CMake] Fixing bots
CMake calls to set_property with APPEND string need to have a leading space.

llvm-svn: 254659
2015-12-03 22:55:36 +00:00
Chris Bieneman
00f689303f [CMake] set_target_properties doesn't append link flags
This fixes a bug introduced in r254627, and another occurance of the same bug in this file.

llvm-svn: 254657
2015-12-03 22:51:08 +00:00
Chris Bieneman
57f58fbc10 [CMake] Removing an unnecessary layer of variable indirection
This prevents passthrough variables from having values.

llvm-svn: 254641
2015-12-03 19:47:04 +00:00
Chris Bieneman
fa052602ba [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO
Summary: This adds support for generating dSYM files and stripping debug info from executables and dylibs. It also supports passing -object_path_lto to the linker to generate dSYMs for LTO builds.

Reviewers: bogner, friss

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15133

llvm-svn: 254627
2015-12-03 18:45:39 +00:00
Pavel Labath
f570e610a0 Fix non-PIC build after 253959
CMAKE_EXE_LINKER_FLAGS is a string. Appending a flag using list(APPEND) introduces an extra
semicolon which breaks stuff. Change this to append the value in the same way that everyone else
seems to be doing.

llvm-svn: 253968
2015-11-24 09:46:01 +00:00
Chris Bieneman
fc7b01b423 [CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.
Building clang with -fno-pie generates slightly faster code. In my not-very-rigorous testing I saw about a 4% speed up using the clang test-suite sources.

llvm-svn: 253959
2015-11-24 08:04:59 +00:00
Chris Bieneman
a03449653c [CMake] export_executable_symbols also needs to add -rdynamic to the linker flags on Darwin
Without -rdynamic LLVM built with LTO fails to pass "check" due to loadable modules failing.

llvm-svn: 253944
2015-11-24 00:58:58 +00:00