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

1541 Commits

Author SHA1 Message Date
Simon Pilgrim
0f4d0047f4 [cmake] Remove MSVC C4800 override
Remove C4800 : ''type' : forcing value to bool 'true' or 'false' (performance warning)' from the list of forced disabled warnings.

I'm not seeing any regressions in VS2017/VS2019 llvm/clang builds from removing this.

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

llvm-svn: 360417
2019-05-10 10:22:13 +00:00
Simon Pilgrim
b25d3737f1 [cmake] Remove MSVC C4355 override
Remove C4355 : ''this' : used in base member initializer list' from the list of forced disabled warnings.

I'm not seeing any regressions in VS2017/VS2019 llvm/clang builds from removing this.

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

llvm-svn: 360413
2019-05-10 09:54:42 +00:00
Simon Pilgrim
64d204e02e Fix whitespace mismatches. NFCI.
Tabs are not our friends.

llvm-svn: 360248
2019-05-08 13:02:32 +00:00
Martin Storsjo
19f9180ee5 [CMake] Install import libraries
Simplify the cmake logic to install both runtime and import
libraries (treated as ARCHIVE), as the later are needed to link
against llvm.

Patch by Julien Schueller!

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

llvm-svn: 360230
2019-05-08 08:37:34 +00:00
Chris Bieneman
bd1db07d46 [CMake] Detecting python modules should be cached
Summary: This requres exec-ing python, which in a trace I ran of the CMake re-configure time took ~2% of the reconfigure time.

Reviewers: phosek, smeenai, compnerd

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 360196
2019-05-07 21:46:55 +00:00
Xing Xue
058f92c5ec Add libc++ to link XRay test cases if libc++ is used to build CLANG
Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.

Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF

Subscribers: dberris, mgorny, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360060
2019-05-06 17:45:21 +00:00
Alexandre Ganea
ed2d1ea835 Fix CMake Invalid Escape Sequence
Patch by xoviat

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

llvm-svn: 360045
2019-05-06 14:07:01 +00:00
Saleem Abdulrasool
3c0a69a728 build: add option to disable unwind tables
The unwind tables (`.eh_frame`, `.arm.extab`) add a significant chunk of data to
the final binaries.  These should not be needed normally, particularly when
exceptions are disabled.  This enables shrinking `lldb-server` by ~18% (3 MiB)
when built with gold.

llvm-svn: 359819
2019-05-02 19:37:26 +00:00
Russell Gallop
47cfb36d4a Add llvm-profdata to LLVM_TOOLCHAIN_TOOLS
This is required for using PGO on Windows but isn't in the Windows
release packages. Windows packages are built with
LLVM_INSTALL_TOOLCHAIN_ONLY so only includes llvm "tools" listed here.

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

llvm-svn: 359569
2019-04-30 15:35:16 +00:00
Russell Gallop
aadfc01dad [cmake] Fix error message on simulated VS version check
For clang-cl self hosts in VS2015 environment this was reporting: "Host
Clang must have at least -fms-compatibility-version=19.00.24213.1, your
version is 9.0.0".

This check fires as CMake detects the simulated environment as _MSC_VER
1900, which is truncated. This makes it less than the required
19.00.24213.1.

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

llvm-svn: 359556
2019-04-30 12:37:10 +00:00
Simon Atanasyan
13532dff44 [cmake] Disable a GCC optimization when building LLVM for MIPS
GCC when compiling LLVM for MIPS can introduce a jump to an uninitialized
value when shrink wrapping is enabled. As shrink wrapping is enabled in
GCC at all optimization levels, it must be disabled. This bug exists for
all versions of GCC since 4.9.2.

This partially resolves PR37701 / GCC PR target/86069.

Patch by Simon Dardis.

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

llvm-svn: 359376
2019-04-27 09:28:54 +00:00
Keno Fischer
2abca233ae [CMake][PowerPC] Recognize LLVM_NATIVE_TARGET="ppc64le" as PowerPC
Summary:
This value is derived from the host triple, which on the machine
I'm currently using is `ppc64le-linux-redhat`. This change makes
LLVM compile.

Reviewers: nemanjai
Differential Revision: https://reviews.llvm.org/D57118

llvm-svn: 359242
2019-04-25 21:28:03 +00:00
Alex Langford
334995ba64 [CMake] Use add_dependencies in add_llvm_install_targets
Summary:
The CMake documentation says that the `DEPENDS` field of
add_custom_target is for files and output of custom commands. Adding a
dependency on a target should be done with `add_dependency`.

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

llvm-svn: 359042
2019-04-23 21:59:07 +00:00
Don Hinton
5e503b6e37 [cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross compile
Escape semicolons in the targets list so that cmake doesn't expand
them to spaces.

llvm-svn: 358859
2019-04-21 19:20:13 +00:00
Chris Bieneman
71e0dfe09e [CMake] Pass monorepo build settings in cross compile
This allows the cross compiled build targets to configure the LLVM tools and sub-projects that are part of the main build.

This is needed for generating native non llvm *-tablegen tools when cross compiling clang in the monorepo build environment.

llvm-svn: 358779
2019-04-19 20:08:55 +00:00
Stefan Granitz
22bfb00747 [CMake] Allow custom extensions for externalized debug info
Summary:
Extra flexibility for emitting debug info to external files (remains Darwin only for now).
LLDB needs this functionality to emit a LLDB.framework.dSYM instead of LLDB.dSYM when building the framework, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.

Reviewers: friss, bogner, beanz

Subscribers: mgorny, aprantl, llvm-commits, #lldb

Tags: #llvm

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

llvm-svn: 358685
2019-04-18 16:37:07 +00:00
Dmitri Gribenko
bf11a7cc89 Removed CMake cache upgrade code from 2011
Summary:
This code was added in r141266 to make a breaking change to CMake, but
still be compatible with existing cache files.  The cache files from
2011 are irrelevant today in 2019.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 358482
2019-04-16 09:46:02 +00:00
Pengxuan Zheng
594362df34 [cmake] Fix dependency issue in TableGen
Summary:
There is a bug in add_tablegen which causes cmake to fail with the following
error message if LLVM_TABLEGEN is set.

CMake Error at cmake/modules/TableGen.cmake:147 (add_dependencies):
  The dependency target "LLVM-tablegen-host" of target "CLANG-tablegen-host"
  does not exist.
Call Stack (most recent call first):
  tools/clang/utils/TableGen/CMakeLists.txt:3 (add_tablegen)

The issue happens because setting LLVM_TABLEGEN causes cmake to skip generating
the LLVM-tablegen-host target. As a result, a non-existent target was added for
CLANG-tablegen-host causing cmake to fail.

In order to fix this issue, this patch adds a guard to check the validity of the
dependency target before adding it as a dependency.

Reviewers: aganea, smeenai

Reviewed By: aganea

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 358226
2019-04-11 21:05:15 +00:00
Martin Storsjo
5628f415b9 [CMake] Fix accidentally swapped input/output parameters of string(REPLACE) for mingw
llvm-svn: 357979
2019-04-09 08:31:25 +00:00
Justin Bogner
7c89ab3542 [CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake
Standalone builds of projects other than llvm itself (lldb, libcxx,
etc) include HandleLLVMOptions but not the top level llvm CMakeLists,
so we need to set this variable here to ensure that it always has a
value.

This should fix the build issues some folks have been seeing.

llvm-svn: 357976
2019-04-09 08:14:32 +00:00
Justin Bogner
dda7e6e86e [CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD
Simplify building with particular C++ standards by replacing the
specific "enable standard X" flags with a flag that allows specifying
the standard you want directly.

We preserve compatibility with the existing flags so that anyone with
those flags in existing caches won't break mysteriously.

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

llvm-svn: 357899
2019-04-08 10:19:17 +00:00
Michal Gorny
35bbe71103 [llvm] [cmake] Add additional headers only if they exist
Modify the add_header_files_for_glob() function to only add files
that do exist, rather than all matches of the glob.  This fixes CMake
error when one of the include directories (which happen to include
/usr/include) contain broken symlinks.

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

llvm-svn: 357701
2019-04-04 14:21:38 +00:00
Shoaib Meenai
ed8d685665 [cmake] Add function for building native tool
Instead of duplicating functionality for building native versions of
tblgen and llvm-config, add a function to set up a native tool build.
This will also be used for llvm-nm in a follow-up.

This should be NFC for tblgen, besides the slightly different COMMENT
for the custom command (it'll display the tablegen target name instead
of always saying TableGen).  For the native llvm-config, it's a behavior
change in that we'll use llvm_ExternalProject_BuildCmd instead of
constructing the build command manually, always build in Release, and
reference the correct binary path for multi-config generators. I believe
all of these changes to be bug fixes.

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

llvm-svn: 357486
2019-04-02 15:58:03 +00:00
Shoaib Meenai
6b082b79de [cmake] Remove use of deprecated generator expression. NFC
Use $<CONFIG> instead of $<CONFIGURATION>, since the latter has been
deprecated since CMake 3.0, and the former is entirely equivalent.

llvm-svn: 357338
2019-03-30 01:35:01 +00:00
Shoaib Meenai
d659807816 [cmake] Reset variable before using it
A bunch of macros use the same variable name, and since CMake macros
don't get their own scope, the value persists across macro invocations,
and we can end up exporting targets which shouldn't be exported. Clear
the variable before each use to avoid this.

Converting these macros to functions would also help, since it would
avoid the variable leaking into its parent scope, and that's something I
plan to follow up with. It won't fully address the problem, however,
since functions still inherit variables from their parent scopes, so if
someone in the parent scope just happened to use the same variable name
we'd still have the same issue.

llvm-svn: 357036
2019-03-26 22:16:53 +00:00
Mikhail R. Gadelha
81dc3f1c2d Moved everything SMT-related to LLVM and updated the cmake scripts.
Differential Revision: https://reviews.llvm.org/D54978

llvm-svn: 356929
2019-03-25 17:47:45 +00:00
Nico Weber
217c395e5b Remove HAVE_REALPATH from config.h
Its last use was removed in r352916.
No behavior change.

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

llvm-svn: 356579
2019-03-20 17:26:11 +00:00
Alex Langford
111f016973 [CMake] Correct CMake message mode
Summary:
This wasn't actually printing out a CMake warning, it was prepending
"WARN" to the message.

Reviewers: zturner

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 356297
2019-03-15 20:43:53 +00:00
Jason Liu
59e6264189 [AIX][CMake] Changes for building on AIX with XL and GCC
Summary:
In support of IBM's efforts to produce a viable C and C++ LLVM compiler for AIX
(ref: RFC at http://lists.llvm.org/pipermail/llvm-dev/2019-February/130175.html),
this patch adds customizations to the CMake files in order to properly
invoke the host toolchain for the build on AIX.
Additional changes to enable a successful build will follow.

Patch by Xing Xue

Reviewers: hubert.reinterpretcast, jasonliu, sfertile

Reviewed by: hubert.reinterpretcast

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

llvm-svn: 356104
2019-03-13 21:50:25 +00:00
Louis Dionne
638bfc7d2a [NFC][CMake] Improve Status message in the iOS toolchain file
llvm-svn: 356056
2019-03-13 15:35:21 +00:00
Hubert Tong
6a41f396a5 Use AIX version detection at LLVM run-time
Summary:
AIX compilers define macros based on the version of the operating
system.

This patch implements updating of versionless AIX triples to include the
host AIX version. Also, the host triple detection in the build system is
adjusted to strip the AIX version information so that the run-time
detection is preferred.

Reviewers: xingxue, stefanp, nemanjai, jasonliu

Reviewed By: xingxue

Subscribers: mgorny, kristina, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355995
2019-03-13 00:12:43 +00:00
Petr Hosek
d80d14c5a9 [CMake] Support stripping and linking output to .build-id directory
When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

llvm-svn: 355765
2019-03-09 01:26:55 +00:00
Hubert Tong
55192374db Add secondary libstdc++ 4.8 and 5.1 detection mechanisms
Summary:
The date-based approach to detecting unsupported versions of libstdc++
does not handle bug fix releases of older versions. As an example, the
`__GLIBCXX__` value associated with version 5.1, `20150422`, is less
than the values associated with versions 4.8.5 and 4.9.3.

This patch adds secondary checks based on certain properties in
sufficiently new versions of libstdc++.

Reviewers: jfb, tstellar, rnk, sfertile, nemanjai

Reviewed By: jfb

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 355638
2019-03-07 21:28:33 +00:00
Rong Xu
36a2adc1b6 [PGO] Context sensitive PGO (part 4)
Part 4 of CSPGO changes:
(1) add support in cmake for cspgo build.
(2) fix an issue in big endian.
(3) test cases.

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

llvm-svn: 355541
2019-03-06 19:31:37 +00:00
Francis Visoiu Mistrih
7f77ac0406 [OptRemarks] Make OptRemarks more generic: rename OptRemarks to Remarks
Getting rid of the name "optimization remarks" for anything that
involves handling remarks on the client side.

It's safer to do this now, before we get stuck with that name in all the
APIs and public interfaces we decide to export to users in the future.

This renames llvm/tools/opt-remarks to llvm/tools/remarks-shlib, and now
generates `libRemarks.dylib` instead of `libOptRemarks.dylib`.

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

llvm-svn: 355439
2019-03-05 20:45:17 +00:00
Shoaib Meenai
25c7018595 [cmake] Create exports for umbrella library targets
When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

llvm-svn: 355354
2019-03-05 00:38:32 +00:00
Kamil Rytarowski
93c23f7519 Revert duplicate check for DragonFly BSD
Summary: Revert duplicate check for DragonFly BSD

Submitted by tuxillo.

Reviewers: krytarowski

Reviewed By: krytarowski

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 355319
2019-03-04 15:51:02 +00:00
Kamil Rytarowski
2e2558b1bf Unbreak shared library linkage on DragonFlyBSD.
Patch submitted by rimvydas.

Reviewers: llvm-commits, krytarowski, mgorny

Reviewed By: krytarowski, mgorny

Subscribers: mgorny

Tags: #llvm

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

llvm-svn: 355315
2019-03-04 14:36:43 +00:00
Tom Stellard
f3333c1bc5 CMake: Fix stand-alone clang builds since r353268
Summary:
Handle the case where LLVM_MAIN_SRC_DIR is not set and also use
LLVM_CMAKE_DIR for locating installed cmake files rather than
LLVM_CMAKE_PATH.

Reviewers: phosek, andrewrk, smeenai

Reviewed By: phosek, andrewrk, smeenai

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 354417
2019-02-20 01:11:05 +00:00
Daniel Sanders
c51d219e2f Fix builds with llvm/runtimes/compiler-rt after r354365
Compiler-rt doesn't include config-ix which was providing CheckSymbolExists to
the LLVM build. Add it to HandleLLVMOptions to fix this

llvm-svn: 354389
2019-02-19 22:02:38 +00:00
Daniel Sanders
d5b0d52a8c Fix builds for older macOS deployment targets after r354365
Surprisingly, check_symbol_exists is not sufficient. The macOS linker checks the
called functions against a compatibility list for the given deployment target
and check_symbol_exists doesn't trigger this check as it never calls the
function.

This fixes the GreenDragon bots where the deployment target is 10.9

llvm-svn: 354374
2019-02-19 19:45:03 +00:00
Daniel Sanders
6542491095 Annotate timeline in Instruments with passes and other timed regions.
Summary:
Instruments is a useful tool for finding performance issues in LLVM but it can
be difficult to identify regions of interest on the timeline that we can use
to filter the profiler or allocations instrument. Xcode 10 and the latest
macOS/iOS/etc. added support for the os_signpost() API which allows us to
annotate the timeline with information that's meaningful to LLVM.

This patch causes timer start and end events to emit signposts. When used with
-time-passes, this causes the passes to be annotated on the Instruments timeline.
In addition to visually showing the duration of passes on the timeline, it also
allows us to filter the profile and allocations instrument down to an individual
pass allowing us to find the issues within that pass without being drowned out
by the noise from other parts of the compiler.

Using this in conjunction with the Time Profiler (in high frequency mode) and
the Allocations instrument is how I found the SparseBitVector that should have
been a BitVector and the DenseMap that could be replaced by a sorted vector a
couple months ago. I added NamedRegionTimers to TableGen and used the resulting
annotations to identify the slow portions of the Register Info Emitter. Some of
these were placed according to educated guesses while others were placed
according to hot functions from a previous profile. From there I filtered the
profile to a slow portion and the aforementioned issues stood out in the
profile.

To use this feature enable LLVM_SUPPORT_XCODE_SIGNPOSTS in CMake and run the
compiler under Instruments with -time-passes like so:
  instruments -t 'Time Profiler' bin/llc -time-passes -o - input.ll'
Then open the resulting trace in Instruments.

There was a talk at WWDC 2018 that explained the feature which can be found at
https://developer.apple.com/videos/play/wwdc2018/405/ if you'd like to know
more about it.

Reviewers: bogner

Reviewed By: bogner

Subscribers: jdoerfert, mgorny, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 354365
2019-02-19 18:18:31 +00:00
Michal Gorny
ef8b9cdabe [llvm] [cmake] Provide split include paths in LLVMConfig
Modify LLVMConfig to provide split variables for in-source and generated
include paths.  Currently, it uses a single value for both
LLVM_INCLUDE_DIRS and LLVM_INCLUDE_DIR which works for install tree but
fails hard at build tree (where LLVM_INCLUDE_DIR incorrectly contains
multiple values).

Instead, put the generated directory in LLVM_INCLUDE_DIR, and the source
tree in LLVM_MAIN_INCLUDE_DIR which is consistent with in-LLVM builds.
For install tree, both variables will have the same value.

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

llvm-svn: 353924
2019-02-13 08:34:40 +00:00
Michal Gorny
5d3d16669d [llvm] [cmake] Use current directory in GenerateVersionFromVCS
Find dependent scripts of GenerateVersionFromVCS in current directory
rather than ../../cmake/modules.  I do not see any reason why the former
would not work and The latter is incorrect when GenerateVersionFromVCS
is used from install directory (i.e. in stand-alone builds).

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

llvm-svn: 353674
2019-02-11 09:07:07 +00:00
Mikhail R. Gadelha
7db7f7f32f This reverts commit 1440a848a635849b97f7a5cfa0ecc40d37451f5b.
and commit a1853e834c65751f92521f7481b15cf0365e796b.

They broke arm and aarch64

llvm-svn: 353590
2019-02-09 00:46:12 +00:00
Rong Xu
10486b5c91 [Cmake] Add an option to build LLVM using the experimental new pass manager
Add LLVM_USE_NEWPM to build LLVM using the experimental new pass manager.

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

llvm-svn: 353550
2019-02-08 19:31:03 +00:00
Shoaib Meenai
b5d55878f8 [cmake] Pass LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN to NATIVE configure
We should propagate this down to host builds so that e.g. people using
an optimized tablegen can do the sub-configure successfully.

llvm-svn: 353463
2019-02-07 20:58:04 +00:00
JF Bastien
406b84702a Bump minimum toolchain version
Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 353374
2019-02-07 05:20:00 +00:00
Mikhail R. Gadelha
dd981b7599 Move the SMT API to LLVM
Moved everything SMT-related to LLVM and updated the cmake scripts.

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

llvm-svn: 353373
2019-02-07 03:19:45 +00:00
Peter Collingbourne
20a57ab952 build: Remove the cmake check for malloc.h.
As far as I can tell, malloc.h is only being used here to provide
a definition of mallinfo (malloc itself is declared in stdlib.h via
cstdlib). We already have a macro for whether mallinfo is available,
so switch to using that instead.

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

llvm-svn: 353329
2019-02-06 19:20:47 +00:00
Petr Hosek
ec05af2652 [CMake] Unify scripts for generating VCS headers
Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang and lldb. They were both similar,
but different. They were both broken in their own ways, for example the
one used by Clang didn't properly handle monorepo resulting in an
incorrect version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM, Clang and lldb, ensures that the new script
supports both monorepo and standalone SVN and Git setups, and removes
the old scripts.

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

llvm-svn: 353268
2019-02-06 03:51:00 +00:00
JF Bastien
495652a992 Revert "Bump minimum toolchain version"
Reverting D57264 again, it looks like we're down to two bots that need fixing:

polly-amd64-linux
polly-arm-linux

They both have old versions of libstdc++ and recent clang.

llvm-svn: 352954
2019-02-02 06:01:12 +00:00
JF Bastien
5b2eb5b50c Bump minimum toolchain version
Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352951
2019-02-02 05:15:34 +00:00
Stefan Granitz
817d11d6b8 [CMake] Add install targets for utilities to LLVM exports if LLVM_INSTALL_UTILS=ON
Summary: D56606 was only appending target names to the `LLVM_EXPORTS`/`LLVM_EXPORTS_BUILDTREE_ONLY` properties. Targets showed up correctly in the build-tree `LLVMExports.cmake`, but they were missing in the installed one (as we found in https://bugs.llvm.org/show_bug.cgi?id=40443), because install did not register them explicitly.

Reviewers: mgorny, smeenai, beanz, gottesmm, dschuff, tstellar, serge-sans-paille

Reviewed By: smeenai

Subscribers: llvm-commits

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

llvm-svn: 352869
2019-02-01 13:08:09 +00:00
JF Bastien
d34b028451 Revert "Bump minimum toolchain version"
Looks like we still have a few bots that are sad. Let try to get them fixed!

llvm-svn: 352835
2019-02-01 04:44:39 +00:00
JF Bastien
0621177282 Bump minimum toolchain version
Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352834
2019-02-01 04:33:21 +00:00
JF Bastien
d979e38527 Revert "Bump minimum toolchain version"
A handful of bots are still breaking, either because I missed them in my audit,
they were offline, or something else. I'm contacting their authors, but I'll
revert for now and re-commit later.

llvm-svn: 352814
2019-01-31 23:29:39 +00:00
JF Bastien
023da30e96 Bump minimum toolchain version
Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352811
2019-01-31 23:13:10 +00:00
Shoaib Meenai
95e2e63b36 [cmake] Note future cleanup in comment. NFC
CMake 3.6 introduced CMAKE_TRY_COMPILE_PLATFORM_VARIABLES, which solves
precisely the problem that necessitated init_user_prop, so we can switch
over whenever we bump our minimum CMake requirement.

llvm-svn: 352790
2019-01-31 20:32:45 +00:00
Petr Hosek
be96a2d9e7 Revert "[CMake] Unify scripts for generating VCS headers"
This reverts commits r352729 and r352731: this broke Sanitizer Windows bots

llvm-svn: 352733
2019-01-31 07:12:43 +00:00
Petr Hosek
874d1380a0 [CMake] Unify scripts for generating VCS headers
Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang. They were both similar, but
different. They were both broken in their own ways, for example the one
used by Clang didn't properly handle monorepo resulting in an incorrect
version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM and Clang, ensures that the new script supports both
monorepo and standalone SVN and Git setups, and removes the old scripts.

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

llvm-svn: 352729
2019-01-31 06:21:01 +00:00
Stefan Granitz
f4a52b4401 [CMake] Accept ENTITLEMENTS in llvm_add_library()
Summary: We added support for code signing entitlements in add_llvm_executable() with D54443. In the future it would be useful to have this functionality available also for libraries.

Reviewers: beanz, bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits, lldb-commits, #lldb

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

llvm-svn: 352628
2019-01-30 15:10:08 +00:00
Michal Gorny
af50a668bf [cmake] Fix get_llvm_lit_path() to respect LLVM_EXTERNAL_LIT always
Refactor the get_llvm_lit_path() logic to respect LLVM_EXTERNAL_LIT,
and require the fallback to be defined explicitly
as LLVM_DEFAULT_EXTERNAL_LIT. This fixes building libcxx standalone
after r346888.

The old logic was using LLVM_EXTERNAL_LIT both as user-defined cache
variable and an optional pre-definition of default value from caller
(e.g. libcxx). It included a hack to make this work by assigning
the value back and forth but it was fragile and stopped working
in libcxx.

The new logic is simpler and more transparent. Default value is
provided in a separate variable, and used only when user-specified
variable is empty (i.e. not overriden).

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

llvm-svn: 352374
2019-01-28 15:16:03 +00:00
Serge Guelton
1e000b2c69 Fix llvm::is_trivially_copyable portability issues
llvm::is_trivially_copyable portability is verified at compile time using
std::is_trivially_copyable as the reference implementation.

Unfortunately, the latter is not available on all platforms, so introduce
a proper configure check to detect if it is available on the target platform.

In a similar manner, std::is_copy_assignable is not fully supported for gcc4.9.
Provide a portable (?) implementation instead.

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

llvm-svn: 351820
2019-01-22 13:48:55 +00:00
JF Bastien
dec3ae0936 Document toolchain update policy
Summary:
Capture the current agreed-upon toolchain update policy based on the following
discussions:

  - LLVM dev meeting 2018 BoF "Migrating to C++14, and beyond!"
    llvm.org/devmtg/2018-10/talk-abstracts.html#bof3
  - A Short Policy Proposal Regarding Host Compilers
    lists.llvm.org/pipermail/llvm-dev/2018-May/123238.html
  - Using C++14 code in LLVM (2018)
    lists.llvm.org/pipermail/llvm-dev/2018-May/123182.html
  - Using C++14 code in LLVM (2017)
    lists.llvm.org/pipermail/llvm-dev/2017-October/118673.html
  - Using C++14 code in LLVM (2016)
    lists.llvm.org/pipermail/llvm-dev/2016-October/105483.html
  - Document and Enforce new Host Compiler Policy
    llvm.org/D47073
  - Require GCC 5.1 and LLVM 3.5 at a minimum
    llvm.org/D46723

Subscribers: jkorous, dexonsmith, llvm-commits

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

llvm-svn: 351765
2019-01-21 23:53:52 +00:00
Dylan McKay
cafb601214 [AVR] Allow AVR to be explicitly set as the default target triple
This extends the CMake cross compilation logic so that AVR can be set as
the default target triple, and thus the generic codegen tests can be
run.

This used to be possible on AVR; the CMake configuration files have
since been changed.

With this patch, 'cmake -DLLVM_DEFAULT_TARGET_TRIPLE=avr-unknown-unknown' can
be passed on the command line, making the `-mcpu` argument redundant to
'llc' and friends.

llvm-svn: 351678
2019-01-20 11:12:39 +00:00
JF Bastien
36109c9464 [NFC] Factor out + document build requirements
Summary: This change factors out compiler checking / warning, and documents LLVM_FORCE_USE_OLD_TOOLCHAIN. It doesn't introduce any functional changes nor policy changes, these will come late.

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits

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

llvm-svn: 351387
2019-01-16 22:22:38 +00:00
Stefan Granitz
5993f667ea [CMake] Export utility targets to the build/install tree depending on LLVM_BUILD/INSTALL_UTILS
Summary:
Allow external projects to import test-related targets like FileCheck, count, not etc. and query binary paths, properties, etc.
This would be useful for LLDB, because it reduces the difference between in-tree vs. standalone builds and simplifies CMake logic.

Reviewers: chapuni, gottesmm, beanz

Reviewed By: beanz

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

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

llvm-svn: 350959
2019-01-11 19:34:34 +00:00
Stefan Granitz
8c5f738610 [CMake] Use XCODE_ATTRIBUTE properties for code signing and entitlements in Xcode
Summary: A post-commit comment to D55116 amended that this was the correct way for code signing in Xcode.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 350383
2019-01-04 09:22:32 +00:00
Tom Stellard
ab11edc4b3 Fix mingw build failures caused by r349839
Reviewers: mstorsjo

Subscribers: mgorny, llvm-commits

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

llvm-svn: 349990
2018-12-22 03:43:08 +00:00
Tom Stellard
e84d87abe0 Fix Windows build failures caused by r349839
llvm-svn: 349846
2018-12-20 22:36:02 +00:00
Tom Stellard
c1b672534d cmake: Remove add_llvm_loadable_module()
Summary:
This function is very similar to add_llvm_library(),  so this patch merges it
into add_llvm_library() and replaces all calls to add_llvm_loadable_module(lib ...)
with add_llvm_library(lib MODULE ...)

Reviewers: philip.pfaffe, beanz, chandlerc

Reviewed By: philip.pfaffe

Subscribers: chapuni, mgorny, llvm-commits

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

llvm-svn: 349839
2018-12-20 22:04:08 +00:00
Alexandre Ganea
f107767821 Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
(was reverted by mistake)

llvm-svn: 349672
2018-12-19 19:42:21 +00:00
Alexandre Ganea
d4b6310f63 Revert r349517 "[CMake] Default options for faster executables on MSVC"
llvm-svn: 349656
2018-12-19 18:01:42 +00:00
Alexandre Ganea
028b8bbe8e Revert r349517 "[CMake] Default options for faster executables on MSVC"
llvm-svn: 349654
2018-12-19 17:57:31 +00:00
Nico Weber
60a32e805a Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2
This relands r330742:
"""
Let TableGen write output only if it changed, instead of doing so in cmake.

Removes one subprocess and one temp file from the build for each tablegen
invocation.

No intended behavior change.
"""

In particular, if you see rebuilds after this change that you didn't see
before this change, that's unintended and it's fine to revert this change
again (but let me know).

r330742 got reverted because some people reported that llvm-tblgen ran on every
build after it.  This could happen if the depfile output got deleted without
deleting the main .inc output. To fix, make TableGen always write the depfile,
but keep writing the main .inc output only if it has changed. This matches what
we did in cmake before.

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

llvm-svn: 349624
2018-12-19 13:35:53 +00:00
Alexandre Ganea
5f00f43799 Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
This workaround simply chains tablegen projects.

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

llvm-svn: 349596
2018-12-19 01:30:29 +00:00
Alexandre Ganea
a22e4bce2c Revert r349541 (Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen)
llvm-svn: 349545
2018-12-18 21:39:40 +00:00
Alexandre Ganea
c1be8338e0 Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen
Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
This workaround simply chains tablegen projects.

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

llvm-svn: 349541
2018-12-18 21:03:06 +00:00
Alexandre Ganea
b297f9fb27 [CMake] Default options for faster executables on MSVC
- Disable incremental linking by default. /INCREMENTAL adds extra thunks in the EXE, which makes execution slower.
- Set /MT (static CRT lib) by default instead of CMake's default /MD (dll CRT lib). The previous default /MD makes all DLL functions to be thunked, thus making execution slower (memcmp, memset, etc.)
- Adds LLVM_ENABLE_INCREMENTAL_LINK which is set to OFF by default.

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

llvm-svn: 349517
2018-12-18 18:17:00 +00:00
Stefan Granitz
b659e7b4c4 [CMake] llvm_codesign workaround for Xcode double-signing errors
Summary:
When using Xcode to build LLVM with code signing, the post-build rule is executed even if the actual build-step was skipped. This causes double-signing errors. We can currently only avoid it by passing the `--force` flag.

Plus some polishing for my previous patch D54443.

Reviewers: beanz, kubamracek

Reviewed By: kubamracek

Subscribers: #lldb, mgorny, llvm-commits

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

llvm-svn: 349070
2018-12-13 18:51:19 +00:00
Stefan Granitz
fc767a4720 [CMake] Add support for NO_INSTALL_RPATH argument in llvm_add_library()
Summary:
Allow clients to suppress setup of default RPATHs in designated library targets. This is used in LLDB when emitting liblldb as a framework bundle, which itself doesn't load further RPATH-dependent libraries.
This follows the approach in add_llvm_executable().

Reviewers: aprantl, JDevlieghere, davide, friss

Reviewed By: aprantl

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

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

llvm-svn: 348573
2018-12-07 09:12:54 +00:00
Shoaib Meenai
857d5c10eb [cmake] Clean up add_llvm_subdirectory
I found the pattern of setting the project_BUILD variable to OFF after
processing the project to be pretty confusing. Using global properties
to explicitly keep track of whether a project has been processed or not
seems much more straightforward, and it also allows us to convert the
macro into a function (which is required for the early return).

Factor the project+type+name combination out into a variable while I'm
here, since it's used a whole bunch of times.

I don't believe this should result in any functional changes.

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

llvm-svn: 348180
2018-12-03 20:05:11 +00:00
Stefan Granitz
e03d279ac1 [CMake] Add LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR for custom dSYM target directory on Darwin
Summary: When using `LLVM_EXTERNALIZE_DEBUGINFO` in LLDB, the default dSYM location for the shared library in LLDB.framework is inside the framework bundle. With `LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR` we can easily fix that. I consider it a useful feature to be able to set a global output directory for external debug info (rather then having a target-specific one). Only implemented for Darwin so far.

Reviewers: beanz, aprantl

Reviewed By: aprantl

Subscribers: mgorny, aprantl, #lldb, lldb-commits, llvm-commits

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

llvm-svn: 348118
2018-12-03 10:42:32 +00:00
Shoaib Meenai
41f235b1de [CMake] build correctly if build path contains whitespace
The add_llvm_symbol_exports function in AddLLVM.cmake creates command
line link flags with paths containing CMAKE_CURRENT_BINARY_DIR, but that
will break if CMAKE_CURRENT_BINARY_DIR contains whitespace. This patch
adds quotes to those paths.

Fixes PR39843.

Patch by John Garvin.

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

llvm-svn: 347937
2018-11-30 00:30:53 +00:00
Argyrios Kyrtzidis
27a03b19f4 [Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms
Summary:
getLastAccessedTime() and getLastModificationTime() provided times in nanoseconds but with only 1 second resolution, even when the underlying file system could provide more precise times than that.
These changes add sub-second precision for unix platforms that support improved precision.

Also add some comments to make sure people are aware that the resolution of times can vary across different file systems.

Reviewers: labath, zturner, aaron.ballman, kristina

Reviewed By: aaron.ballman, kristina

Subscribers: lebedev.ri, mgorny, kristina, llvm-commits

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

llvm-svn: 347530
2018-11-26 00:03:39 +00:00
Haojian Wu
0ea34b9a2d Revert r343473 "Move llvm util dependencies from clang-tools-extra to add_lit_target."
Summary:
It will cause test tools `FileCheck`, `count`, `not` being built blindly, these
dependencies should move back to clang-tools-extra.

Reviewers: mgorny

Subscribers: llvm-commits

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

llvm-svn: 347448
2018-11-22 10:14:24 +00:00
Aaron Ballman
2a7e359d79 Silence C4709 in MSVC because it is buggy.
The diagnostic will trigger on code that does not have any comma operator, but instead default-constructs an object with an explicitly defaulted constructor as the array index argument.

llvm-svn: 347345
2018-11-20 20:50:04 +00:00
Kamil Rytarowski
739bcc45e8 Swap order of discovering of -ltinfo and -lterminfo
Summary:
NetBSD ships with native curses(3) and -ltinfo is a part of ncurses.
Set -lterminfo before -ltinfo, as it allows to prioritize native curses
libraries. Mixing curses and ncurses does not work well, especially
in software built on top of llvm.

Original patch by Ryo Onodera (NetBSD) in pkgsrc.

Reviewers: labath, dim, mgorny

Reviewed By: dim, mgorny

Subscribers: llvm-commits

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

llvm-svn: 347156
2018-11-18 12:13:51 +00:00
Stefan Granitz
a6180e2036 [CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
Summary: Allow code-signing with entitlements. FORCE may be used to avoid an error when replacing existing signatures.

Reviewers: beanz, bogner

Reviewed By: beanz

Subscribers: mgorny, llvm-commits, lldb-commits

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

llvm-svn: 347068
2018-11-16 18:10:36 +00:00
Petr Hosek
2809cba9ae [CMake] Support cross-compiling with multi-stage builds
When using multi-stage builds, we would like support cross-compilation.
Example is 2-stage build when the first stage is compiled for host while
the second stage is compiled for the target.

Normally, the second stage would be also used for compiling runtimes,
but that's not possible when cross-compiling, so we use the first stage
compiler instead. However, we still want to use the second stage paths.
To do so, we set the -resource-dir of the first stage compiler to point
to the resource directory of the second stage.

We also need compiler tools that support the target architecture. These
tools are not guaranteed to be present on the host, but in case of
multi-stage build, we can build these tools in the first stage.

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

llvm-svn: 347025
2018-11-16 04:46:48 +00:00
David Carlier
54805cd6a4 Fix DragonFlyBSD linkage issue.
environ global failed on LTO linkage step.

llvm-svn: 346593
2018-11-10 18:47:00 +00:00
Francis Visoiu Mistrih
711367c6c9 [CMake] Expose opt-remark tooling through libOptRemarks.dylib
* Create an install target for it
* Add it under tools/opt-remarks
* Add an export file for the dylib
* Install the llvm-c/OptRemarks.h header
* Add an API to query its version

rdar://45458839

llvm-svn: 346127
2018-11-05 11:57:44 +00:00
Reid Kleckner
2a4a060cab Enable -Wimplicit-fallthrough for clang as well as GCC
All instances of this warning should already be fixed across all LLVM
subprojects, at least on Linux.

llvm-svn: 345887
2018-11-01 20:31:44 +00:00
Martin Storsjo
df49618082 [MinGW] Enable large file for mingw-w64
64-bit mingw doesn't define _FILE_OFFSET_BITS=64 by default.

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

llvm-svn: 345131
2018-10-24 12:22:12 +00:00
Chris Bieneman
cc204c98f2 [CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES
There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate.

This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value.

With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience.

This is a re-land of r340435, with a few minor fix-ups. The issues causing the revert were addressed in r344218, r344219, and r344553.

llvm-svn: 344555
2018-10-15 21:20:02 +00:00
Chris Bieneman
96e5657888 [CMake] Change the default value of LLVM_ENABLE_IDE
There really aren't any generator behaviors that we need to take `CMAKE_EXTRA_GENERATOR` into account for. Where we need to take different behaviors for IDEs is mostly in enabling or disabling certain build system features that are optional but trip up the IDE UIs. Like the generation of lots of utility targets.

By changing the LLVM_ENABLE_IDE default to only being on for multi-configuration generators, we allow gating where it will impact the UI presentation, while also supporting optionally disabling the generation if your tooling workflow encounters problems. Presently being able to manually disable extra target generation is useful for Visual Studio 2017's CMake integration where the IDE has trouble displaying and working with the large number of optional targets.

llvm-svn: 344553
2018-10-15 21:14:19 +00:00
Chris Bieneman
fff37cd2de [CMake] Temporarily remove the LLVM_ENABLE_IDE option
All uses of this option have been removed, and the intent is to change the purpose and default value of this option. To prevent it from having impacts on users, this patch temporarily removes the option and purges it from CMake caches. In a few days, once this has propagated to contributors I will re-introduce the option with the new default value.

llvm-svn: 344219
2018-10-11 04:06:14 +00:00
Chris Bieneman
d5e02c8a98 [CMake] Unconditionally add .h and .td files to target sources
Previously adding header and table gen files was conditional on using an IDE. Since these files have the `HEADER_FILE_ONLY` attribute applied they are ignored as sources by all non-IDE generators, so there is really no reason not to include them.

Additionally having the CMake always include these files allows the CMake-server to include them in the sources list for targets, which is valuable to anyone using CMake-server integrated tools.

llvm-svn: 344218
2018-10-11 04:02:53 +00:00
Chris Bieneman
e17657a758 [CMake] NFC. Updating documentation on options
The Ninja pool options are only supported with the Ninja generator and
should be called out as such.

llvm-svn: 344188
2018-10-10 21:36:12 +00:00
Shoaib Meenai
c26a80208b [cmake] Also create lowercase extension WinSDK symlinks
Some projects rely on using libraries from the Windows SDK with their
original casing, just with a lowercase extension. E.g. the WinSock2 lib
is named WS2_32.Lib in the Windows SDK, and we would previously only
create a ws2_32.lib symlink for it (i.e. all lowercase). Also create a
WS2_32.lib symlink (i.e. original casing with lowercase extension) to
cover users of this casing. As a drive-by fix, only create these
symlinks when they differ from the original name to reduce the amount of
noise in the library symlinks directory.

llvm-svn: 343832
2018-10-05 00:08:27 +00:00
Haojian Wu
1385afa7e8 Move llvm util dependencies from clang-tools-extra to add_lit_target.
Summary:
Address fixme in r301762. And would simplify the cmake file in
clang-tools-extra.

Reviewers: sammccall

Subscribers: mgorny, llvm-commits, cfe-commits

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

llvm-svn: 343473
2018-10-01 14:00:51 +00:00
Sven van Haastregt
ad35f5366a [CMake] Avoid REVERSE on unset variable
If required_libs happens to remain unset, CMake would fail with:

  list sub-command REVERSE requires list to be present.

Fix by ensuring we do not attempt to reverse an unset variable.

Reported by Tu Vuong.

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

llvm-svn: 343088
2018-09-26 10:14:10 +00:00
Aaron Ballman
427165a35b Move individual benchmark targets into the Utils folder in IDEs.
llvm-svn: 342785
2018-09-21 23:01:32 +00:00
Lion Yang
023adc2eda Test commit access
Remove trailing spaces

llvm-svn: 342268
2018-09-14 19:43:11 +00:00
Nico Weber
5f1a463b19 Introduce explicit add_unittest_with_input_files target for tests that use llvm::getInputFileDirectory()
Using llvm::getInputFileDirectory() in unit tests is discouraged, so require an explicit opt-in.
This way, cmake also writes ~60 fewer unused files to disk.

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

llvm-svn: 342248
2018-09-14 17:34:46 +00:00
Alexandre Ganea
8d999aab74 [CMake] Fix LLVM_ENABLE_LTO option on Windows
Differential Revision: https://reviews.llvm.org/D51804

llvm-svn: 341701
2018-09-07 20:07:36 +00:00
Zachary Turner
9454b327ad Fix a configure issue with Visual Studio generators.
We can't put the unittest source dir map in the configuration
specific directory because VS doesn't have a configure-specific
directory, instead it only knows this at runtime.  So we have
to remove this from the path.  This in turn means that the path
will be slightly different in VS configurations vs non vs
configurations.  In the former, the source map will be in the
parent directory of the executable, and in the latter it will
be in the same directory as the executable.  So check both.

llvm-svn: 341590
2018-09-06 22:00:38 +00:00
Zachary Turner
8f68390df4 Add support for unittest inputs.
Occasionally it is useful to have unittest which take inputs.
While we normally try to have this test be more of a lit test
we occasionally don't have tools that can exercise the code
in the right way to test certain things.  LLDB has been using
this style of unit test for a while, particularly with regards
to how it tests core dump and minidump file parsing.  Recently
i needed this as well for the case where we want to test that
some of the PDB reading code works correctly.  It needs to
exercise the code in a way that is not covered by any dumper
and would be impractical to implement in one of the dumpers,
but requires a valid PDB file.  Since this is now needed by
more than one project, it makes sense to have this be a
generally supported thing that unit tests can do, and we just
encourage people to use this sparingly.

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

llvm-svn: 341502
2018-09-05 23:30:17 +00:00
Aaron Ballman
a55f327dae Disable -Wnoexcept-type due to false positives with GCC.
GCC triggers false positives if a nothrow function is called through a template argument. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80985 for details. The LLVM libraries have no stable C++ API, so the warning is not useful.

llvm-svn: 341361
2018-09-04 12:03:49 +00:00
Nico Weber
c7dc6a354b Remove LIT_SITE_CFG_IN_FOOTER, llvm
It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341135
2018-08-30 22:13:34 +00:00
Roman Lebedev
3ff355fa36 Revert "[CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES"
That resulted in the check-llvm-* targets not being avaliable
in the QtCreator-configured build directories.

Moreover, that was a clearly non-NFC change, and i can't find any review
for it.

This reverts commit rL340435.

llvm-svn: 341045
2018-08-30 09:32:09 +00:00
Kirill Bobyrev
0f55045526 Pull google/benchmark library to the LLVM tree
This patch pulls google/benchmark v1.4.1 into the LLVM tree so that any
project could use it for benchmark generation. A dummy benchmark is
added to `llvm/benchmarks/DummyYAML.cpp` to validate the correctness of
the build process.

The current version does not utilize LLVM LNT and LLVM CMake
infrastructure, but that might be sufficient for most users. Two
introduced CMake variables:

* `LLVM_INCLUDE_BENCHMARKS` (`ON` by default) generates benchmark
  targets
* `LLVM_BUILD_BENCHMARKS` (`OFF` by default) adds generated
  benchmark targets to the list of default LLVM targets (i.e. if `ON`
  benchmarks will be built upon standard build invocation, e.g. `ninja` or
  `make` with no specific targets)

List of modifications:

* `BENCHMARK_ENABLE_TESTING` is disabled
* `BENCHMARK_ENABLE_EXCEPTIONS` is disabled
* `BENCHMARK_ENABLE_INSTALL` is disabled
* `BENCHMARK_ENABLE_GTEST_TESTS` is disabled
* `BENCHMARK_DOWNLOAD_DEPENDENCIES` is disabled

Original discussion can be found here:
http://lists.llvm.org/pipermail/llvm-dev/2018-August/125023.html

Reviewed by: dberris, lebedev.ri

Subscribers: ilya-biryukov, ioeric, EricWF, lebedev.ri, srhines,
dschuff, mgorny, krytarowski, fedor.sergeev, mgrang, jfb, llvm-commits

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

llvm-svn: 340809
2018-08-28 09:42:41 +00:00
Chris Bieneman
fde8ce5023 [CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES
There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate.

This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value.

With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience.

llvm-svn: 340435
2018-08-22 18:40:24 +00:00
Hans Wennborg
f4be62b408 [cmake] Prevent LLVMgold.so from being unloaded on Linux
Extend the fix from D40459 to also apply to modules such as the LLVM
gold plugin. This is needed because current binutils master (and future
binutils 2.32) calls dlclose() on bfd plugins as part of a recent fix
for https://sourceware.org/bugzilla/show_bug.cgi?id=23460.

Patch by Evangelos Foutras!

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

llvm-svn: 339883
2018-08-16 15:12:12 +00:00
Petr Hosek
0c06d55837 [CMake] Split -gx strip flag into -g -x
llvm-strip doesn't handle -gx spelling, so we need to split these
as two separate flags.

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

llvm-svn: 339639
2018-08-14 02:00:21 +00:00
Petr Hosek
1cfc2ea35f [CMake] Use normalized Windows target triples
Changes the default Windows target triple returned by
GetHostTriple.cmake from the old environment names (which we wanted to
move away from) to newer, normalized ones. This also requires updating
all tests to use the new systems names in constraints.

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

llvm-svn: 339307
2018-08-09 02:16:18 +00:00
Michal Gorny
6403c39fa3 [cmake] Append LLVM_VERSION_SUFFIX to SOVERSION
Append LLVM_VERSION_SUFFIX to SOVERSION. This makes it possible
to use the suffix to differentiate binary-incompatible versions
of LLVM built via BUILD_SHARED_LIBS.

We are planning to use this to temporarily preserve ABI-incompatible
variants of LLVM while switching the system between them, e.g. when
rebuilding the system to use libc++. Normally this would mean that once
LLVM is rebuilt using libc++ all the reverse dependencies become
immediately broken. Using a distinct SOVERSION allows us to preserve
the ABI compatibility before all the packages are rebuilt.

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

llvm-svn: 339286
2018-08-08 20:45:03 +00:00
Michal Gorny
fe3269a360 cmake: Store LLVM_VERSION_SUFFIX in LLVMConfig.cmake
Store LLVM_VERSION_SUFFIX along with other version components
in LLVMConfig.cmake. This fixes preserving the suffix set while building
LLVM to stand-alone builds of other components, e.g. clang,
and therefore improves uniformity between the two build models.

Given that there is no apparent reason to omit this part of version,
that it is distributed to subprojects when building as part of LLVM
and that it is included in LLVM_PACKAGE_VERSION, I think it was omitted
accidentally rather than done on purpose.

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

llvm-svn: 339285
2018-08-08 20:44:58 +00:00
Hans Wennborg
bdae10300d Add llvm-rc to LLVM_TOOLCHAIN_TOOLS (PR38386)
This means it will be installed also in builds configured with
LLVM_INSTALL_TOOLCHAIN_ONLY, such as the Windows packages.

llvm-svn: 338495
2018-08-01 07:51:55 +00:00
Philip Pfaffe
64e5222c0d [CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB if it's set to ON
Summary:
As it was, always exporting LLVM_LINK_LLVM_DYLIB caused out-of-tree
clients to lose the ability to link against the dylib, even if in-tree tools did
not. By only exporting the setting if it is enabled, out-of-tree clients get the
correct default, but may still choose if they can.

Reviewers: mgorny, beanz, labath, bogner, chandlerc

Reviewed By: bogner, chandlerc

Subscribers: bollu, llvm-commits

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

llvm-svn: 338119
2018-07-27 10:57:51 +00:00
Florian Hahn
82faed36eb [UBSan] Also use blacklist for 'Address; Undefined' setting
It looks like currently the UBSan blacklist is only applied when "Undefined" is selected.
This patch updates the cmake file to apply it whenever Undefined is selected
 (e.g. 'Address; Undefined' ). This  allows us to use the workaround added in
rL335525 when using AddressSan and UBSan together.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

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

llvm-svn: 337539
2018-07-20 10:12:31 +00:00
Reid Kleckner
a446bf556d Disable GCC's -Wclass-memaccess warning
It fires on things like SmallVector<std::pair<int, int>>, where we
intentionally use memcpy instead of calling the assignment operator.
This warning fires in practically every LLVM TU, so we have to do
something about it, even if we aren't interested in being 100% warning
clean with GCC.

Reported as PR37337

llvm-svn: 337492
2018-07-19 20:14:46 +00:00
Philip Pfaffe
1002ce3706 [CMake] Export the LLVM_LINK_LLVM_DYLIB setting
Summary:
When building out-of-tree tools, there are several macros available to
automate linking against llvm. An examples is `add_llvm_executable`, or
the clang variant of this.

These macros use the LLVM_LINK_LLVM_DYLIB option to decide whether to
link against libraries defined by setting LLVM_LINK_COMPONENTS or to
link against libLLVM instead. Currently this is problematic in
out-of-tree targets, because they cannot identify whether this option is
required or even available. If the option was enabled in LLVM's own
build, the clang libraries are built against libLLVM, so a client
linking against those must link against it too. On the other hand the
client can't just always link against it, because it might not be
available.

This is related to D44391, but that change assumed the client knew
whether they wanted the dylib or not.

Reviewers: mgorny, beanz, labath

Reviewed By: mgorny

Subscribers: bollu, llvm-commits

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

llvm-svn: 337366
2018-07-18 08:53:31 +00:00
Petr Hosek
ee815080e6 [CMake] Pass CMAKE_INSTALL_DO_STRIP to external projects
This is necessary to make install-<target>-stripped work for
external projects such as runtimes.

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

llvm-svn: 337115
2018-07-15 02:12:25 +00:00
Justin Bogner
d3016d423d [CMake] Teach the build system to codesign built products
Automatically codesign all executables and dynamic libraries if a
codesigning identity is given (via LLVM_CODESIGNING_IDENTITY). This
option is darwin only for now.

Also update platforms/iOS.cmake to pick up the right versions of
codesign and codesign_allocate.

llvm-svn: 336708
2018-07-10 17:32:48 +00:00
Filipe Cabecinhas
549730082d [cmake] Change WIN32 test to CMAKE_HOST_WIN32
The test is about what can be run on the host, not the cmake target.
When cross-compiling (compiler-rt at least) on Windows, we end up with
lit being unable to run llvm-lit because it can't find the llvm-lit
module.

llvm-svn: 335961
2018-06-29 10:34:37 +00:00
Justin Bogner
fa021a2fac [CMake] Respect CMAKE_STRIP and CMAKE_DSYMUTIL on apple platforms
This allows overriding the strip and dsymutil tools, and updates
iOS.cmake to do so. I've also added libtool to iOS.cmake, but it was
already respecting CMAKE_LIBTOOL if set.

llvm-svn: 335900
2018-06-28 18:36:52 +00:00
Petr Hosek
4f4061d600 [CMake] Use variables rather than ":" delimiters
This is a more idiomatic CMake.

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

llvm-svn: 335703
2018-06-27 03:14:41 +00:00
Brad Smith
8ca02f1807 [CMake] Do not use --gc-sections on OpenBSD
llvm-svn: 335425
2018-06-23 21:43:27 +00:00
Shoaib Meenai
00e5a5e3bd [cmake] Change ON/OFF to YES/NO. NFC
compnerd pointed out that the latter reads better over here.

llvm-svn: 334781
2018-06-14 23:40:04 +00:00
Shoaib Meenai
4ae4788876 [cmake] Add linker detection for Apple platforms
LLVM currently assumes that Apple platforms will always use ld64. In the
future, LLD Mach-O might also be supported, so add the beginnings of
linker detection support. ld64 is currently the only detected linker,
since `ld64.lld -v` doesn't yield any useful version output, but we can
add that detection later, and in the meantime it's still useful to have
the ld64 identification.

Switch clang's order file check to use this new detection rather than
just checking for the presence of an ld64 executable.

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

llvm-svn: 334780
2018-06-14 23:26:33 +00:00
Bruno Cardoso Lopes
11b4351a5f [CMAKE] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2
On MacOS, if CMAKE_OSX_SYSROOT is used and the user has command line tools
installed, we currently get the include path for libxml2 as
/usr/include/libxml2, instead of ${CMAKE_OSX_SYSROOT}/usr/include/libxml2.

Make it consistent on MacOS by prefixing ${CMAKE_OSX_SYSROOT} when
possible.

rdar://problem/41103601

llvm-svn: 334746
2018-06-14 18:19:54 +00:00
Petr Hosek
2480179bdd [CMake] Pass additional CMake tools to external projects
This is needed when the external projects try to use other tools
besides just the compiler and the linker.

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

llvm-svn: 334136
2018-06-06 21:43:37 +00:00
Pavel Labath
e0e9132081 [cmake] fix a typo in llvm_config macro
Summary:
The macro parses out the USE_SHARED option out of the argument list, but
then ignores it and accesses the variable with the same name instead. It
seems the intention here was to check the argument value.

Technically, this is NFC, because the only in-tree usage
(add_llvm_executable) of USE_SHARED sets both the variable and the
argument when calling llvm_config, but it makes the usage of this macro
for out-of-tree users more sensible.

Reviewers: mgorny, beanz

Reviewed By: mgorny

Subscribers: foutrelis, llvm-commits

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

llvm-svn: 334082
2018-06-06 10:07:08 +00:00
Nico Weber
4d14352f33 Use -Wextra spelling instead of -W
No difference in behavior, but a bit easier to search for.
https://reviews.llvm.org/D47490

llvm-svn: 333651
2018-05-31 13:41:04 +00:00
Reid Kleckner
fd0e6cf515 Remove CMake workaround for LLD PR24476 which is no longer needed
llvm-svn: 332880
2018-05-21 20:14:46 +00:00
Nico Weber
51d6701090 Revert 332750, llvm part (see comment on D46910).
llvm-svn: 332823
2018-05-20 23:03:17 +00:00
Vassil Vassilev
d9088961cc [cmake] Add a switch to enable/disable bindings.
Differential Revision: https://reviews.llvm.org/D42026

llvm-svn: 332816
2018-05-20 08:37:54 +00:00
Nico Weber
53628c120e Enable colored diagnostics in ninja builds when building with gcc 4.9+.
GCC has supported -fdiagnostics-color since 4.9.

https://reviews.llvm.org/D47083

llvm-svn: 332793
2018-05-19 02:36:27 +00:00
Petr Hosek
5f84b3720a [Support] Avoid normalization in sys::getDefaultTargetTriple
The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

llvm-svn: 332750
2018-05-18 18:33:07 +00:00
Chris Bieneman
c8ad1f12f2 [CMake] Make optimizing sanitizer builds optional
This behavior has been the default for a long time, so the default value is On, however this can make it difficult to debug sanitizer failures, so we should have an option to turn it off.

llvm-svn: 332628
2018-05-17 16:55:29 +00:00
Petr Hosek
a12eb6a357 [CMake] Use CMAKE_OBJCOPY and CMAKE_STRIP to externalize debug info
Don't hardcode objcopy and strip names, rather use CMAKE_OBJCOPY and
CMAKE_STRIP variables which allows users to override the tools used
such as using llvm-objcopy and llvm-strip instead of binutils versions.

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

llvm-svn: 331827
2018-05-09 00:07:42 +00:00
Chandler Carruth
5b6b9b3232 Revert r330742: Let TableGen write output only if it changed, instead of doing so in cmake.
This change causes us to re-run tablegen for every single target on
every single build. This is much, much worse than the problem being
fixed AFAICT.

On my system, it makes a clean rebuild of `llc` with nothing changed go
from .5s to over 8s. On systems with less parallelism, slower file
systems, or high process startup overhead this will be even more
extreme.

The only way I see this could be a win is in clean builds where we churn
the filesystem. But I think incremental rebuild is more important, and
so if we want to re-instate this, it needs to be done in a way that
doesn't trigger constant re-runs of tablegen.

llvm-svn: 331702
2018-05-07 23:41:48 +00:00
Petr Hosek
8259fee6a9 [Support] Support building LLVM for Fuchsia
These are necessary changes to support building LLVM for Fuchsia.
While these are not sufficient to run on Fuchsia, they are still
useful when cross-compiling LLVM libraries and runtimes for Fuchsia.

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

llvm-svn: 331423
2018-05-03 01:38:49 +00:00
Nico Weber
da42110efc Stop setting LLVM_ON_WIN32 in config.h and llvm-config.h.
See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.

I replaced all uses of LLVM_ON_WIN32 with _WIN32 in r331127 (llvm),
r331069 (clang), r329697 (lldb), r329696 (lld), r329696 (clang-tools-extra).

If your out-of-tree program used LLVM_ON_WIN32, just use _WIN32 instead, which
is set at exactly the same time to exactly the same value.

https://reviews.llvm.org/D46264

llvm-svn: 331224
2018-04-30 20:19:48 +00:00
Shoaib Meenai
2b5151e0b0 [cmake] Make linker detection take flags into account
LLVM might be compiled using a toolchain file which controls the linker
to use via flags (e.g. `-B` or `-fuse-ld=`). Take these flags into
account for linker detection. We can also correct the detection by
manually passing LLVM_USE_LINKER, of course, but it seems more
convenient to have the detection take flags into account.

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

llvm-svn: 330924
2018-04-26 06:04:46 +00:00
Nico Weber
4377f43d2b Rename Attributes.gen, Intrinsics.gen to Attributes.inc, Intrinsics.inc
Virtually all other tablegen outputs are called .inc, not .gen, so rename these two too for consistency.
No behavior change.

https://reviews.llvm.org/D46058

llvm-svn: 330843
2018-04-25 17:07:46 +00:00
Shoaib Meenai
8601096ed0 [cmake] Fix libc++ detection
-stdlib=libc++ is added to both the compilation and the link flags, but
the logic for adding it was only checking if it was supported during
compilation and not linking. This could lead to false positives, for
example when using clang with libstdc++ (where the compiler would
support -stdlib=libc++ but then linking would fail because of libc++
actually being unavailable).

llvm-svn: 330761
2018-04-24 19:47:39 +00:00
Nico Weber
c47070a3d3 Let TableGen write output only if it changed, instead of doing so in cmake.
Removes one subprocess and one temp file from the build for each tablegen
invocation.

No intended behavior change.

https://reviews.llvm.org/D45899

llvm-svn: 330742
2018-04-24 17:29:05 +00:00