Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release/14.x' into rustc/14.0-…
Browse files Browse the repository at this point in the history
…2022-02-09
  • Loading branch information
nikic committed Feb 16, 2022
2 parents 54c5869 + 9bc22aa commit e29ac13
Show file tree
Hide file tree
Showing 234 changed files with 3,321 additions and 1,907 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,25 @@ This is an example work-flow and configuration to get and build the LLVM source:

Some common options:

* ``-DLLVM_ENABLE_PROJECTS='...'`` --- semicolon-separated list of the LLVM
sub-projects you'd like to additionally build. Can include any of: clang,
clang-tools-extra, compiler-rt,cross-project-tests, flang, libc, libclc,
libcxx, libcxxabi, libunwind, lld, lldb, mlir, openmp, polly, or pstl.
* ``-DLLVM_ENABLE_PROJECTS='...'`` and ``-DLLVM_ENABLE_RUNTIMES='...'`` ---
semicolon-separated list of the LLVM sub-projects and runtimes you'd like to
additionally build. ``LLVM_ENABLE_PROJECTS`` can include any of: clang,
clang-tools-extra, cross-project-tests, flang, libc, libclc, lld, lldb,
mlir, openmp, polly, or pstl. ``LLVM_ENABLE_RUNTIMES`` can include any of
libcxx, libcxxabi, libunwind, compiler-rt, libc or openmp. Some runtime
projects can be specified either in ``LLVM_ENABLE_PROJECTS`` or in
``LLVM_ENABLE_RUNTIMES``.

For example, to build LLVM, Clang, libcxx, and libcxxabi, use
``-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"``.
``-DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``.

* ``-DCMAKE_INSTALL_PREFIX=directory`` --- Specify for *directory* the full
path name of where you want the LLVM tools and libraries to be installed
(default ``/usr/local``).
(default ``/usr/local``). Be careful if you install runtime libraries: if
your system uses those provided by LLVM (like libc++ or libc++abi), you
must not overwrite your system's copy of those libraries, since that
could render your system unusable. In general, using something like
``/usr`` is not advised, but ``/usr/local`` is fine.

* ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for *type* are Debug,
Release, RelWithDebInfo, and MinSizeRel. Default is Debug.
Expand Down
5 changes: 3 additions & 2 deletions bolt/docs/OptimizingClang.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Collecting accurate profile requires running `perf` on a hardware that
implements taken branch sampling (`-b/-j` flag). For that reason, it may not be possible to
collect the accurate profile in a virtualized environment, e.g. in the cloud.
We do support regular sampling profiles, but the performance
improvements are expected to be more modest.
improvements are expected to be more modest.

```bash
$ mkdir ${TOPLEV}/stage3
Expand Down Expand Up @@ -211,7 +211,8 @@ $ cd ${TOPLEV}/stage1
$ cmake -G Ninja ${TOPLEV}/llvm-project/llvm -DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_ASM_COMPILER=gcc \
-DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCMAKE_INSTALL_PREFIX=${TOPLEV}/stage1/install
Expand Down
13 changes: 11 additions & 2 deletions clang-tools-extra/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUN

llvm_canonicalize_cmake_booleans(
CLANG_TIDY_ENABLE_STATIC_ANALYZER
LLVM_ENABLE_PLUGINS
CLANG_PLUGIN_SUPPORT
LLVM_INSTALL_TOOLCHAIN_ONLY
)

Expand Down Expand Up @@ -87,10 +87,19 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
PLUGIN_TOOL clang-tidy
DEPENDS clang-tidy-headers)

if(CLANG_BUILT_STANDALONE)
# LLVMHello library is needed below
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
AND NOT TARGET LLVMHello)
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
lib/Transforms/Hello)
endif()
endif()

if(TARGET CTTestTidyModule)
list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
set(LLVM_LINK_COMPONENTS
Support
)
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
config.python_executable = "@Python3_EXECUTABLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
config.has_plugins = @LLVM_ENABLE_PLUGINS@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@

# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Expand Down
4 changes: 4 additions & 0 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ add_definitions( -D_GNU_SOURCE )
option(CLANG_BUILD_TOOLS
"Build the Clang tools. If OFF, just generate build targets." ON)

CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
"Build clang with plugin support" ON
"LLVM_ENABLE_PLUGINS OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS" OFF)

option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
option(CLANG_ENABLE_STATIC_ANALYZER
"Include static analyzer in clang binary." ON)
Expand Down
6 changes: 3 additions & 3 deletions clang/docs/DataFlowSanitizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ libc++ and the libc++ ABI with data flow sanitizer instrumentation.

.. code-block:: console
mkdir libcxx-build
cd libcxx-build
# An example using ninja
cmake -GNinja path/to/llvm-project/llvm \
cmake -GNinja -S <monorepo-root>/runtimes \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_USE_SANITIZER="DataFlow" \
-DLLVM_ENABLE_LIBCXX=ON \
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi"
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
ninja cxx cxxabi
Expand Down
Loading

0 comments on commit e29ac13

Please sign in to comment.