Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY
"Install the shared libc++ library." ON
"LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF)
set(LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB "" CACHE STRING
"Builds the clang-tidy plugin with the specified standard library implementation. Must either be blank (use compiler default), 'libc++', or 'libstdc++'.
This should only be set when the clang-tidy binary is built with a different standard library implementation to the compiler's default choice.")

option(LIBCXX_ABI_UNSTABLE "Use the unstable ABI of libc++. This is equivalent to specifying LIBCXX_ABI_VERSION=n, where n is the not-yet-stable version." OFF)
if (LIBCXX_ABI_UNSTABLE)
Expand Down
11 changes: 11 additions & 0 deletions libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ set(SOURCES
)

add_library(cxx-tidy MODULE ${SOURCES})
if(LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB)
if(LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB STREQUAL "libc++" OR LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB STREQUAL "libstdc++")
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
target_compile_options(cxx-tidy PUBLIC -stdlib=${LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB})
else()
message(ERROR "LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB can only be set with Clang or AppleClang (currently using ${CMAKE_CXX_COMPILER_ID}).")
endif()
else()
message(ERROR "LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB must either be empty, 'libc++', or 'libstdc++' (got '${LIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB}').")
endif()
endif()
target_link_libraries(cxx-tidy clangTidy)

set_target_properties(cxx-tidy PROPERTIES
Expand Down
38 changes: 26 additions & 12 deletions libcxx/utils/ci/run-buildbot
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,34 @@ cat <<EOF
Usage:
${PROGNAME} [options] <BUILDER>

[-h|--help] Display this help and exit.
[-h|--help] Display this help and exit.

--llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try
to figure it out based on the current working directory.
--llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try
to figure it out based on the current working directory.

--build-dir <DIR> The directory to use for building the library. By default,
this is '<llvm-root>/build/<builder>'.
--build-dir <DIR> The directory to use for building the library. By default,
this is '<llvm-root>/build/<builder>'.

--clang-tidy-stdlib <STDLIB> Builds the clang-tidy plugin with the specified standard
library implementation. By default, this is empty. Valid
options are empty, 'libc++', and 'libstdc++'. You should
only set this option when clang-tidy needs to be linked
against a different standard library implementation to
the compiler's default choice.

This option only works for Clang.

Environment variables
CC The C compiler to use, this value is used by CMake. This
variable is optional.
CC The C compiler to use, this value is used by CMake. This
variable is optional.

CXX The C++ compiler to use, this value is used by CMake. This
variable is optional.
CXX The C++ compiler to use, this value is used by CMake. This
variable is optional.

CMAKE The CMake binary to use. This variable is optional.
CMAKE The CMake binary to use. This variable is optional.

CLANG_FORMAT The clang-format binary to use when generating the format
ignore list.
CLANG_FORMAT The clang-format binary to use when generating the format
ignore list.

EOF
}
Expand All @@ -62,6 +71,10 @@ while [[ $# -gt 0 ]]; do
BUILD_DIR="${2}"
shift; shift
;;
--clang-tidy-stdlib)
BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB="${2}"
shift; shift
;;
*)
BUILDER="${1}"
shift
Expand Down Expand Up @@ -136,6 +149,7 @@ function generate-cmake-base() {
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DLIBCXX_ENABLE_WERROR=YES \
-DLIBCXX_BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB="${BUILD_CLANG_TIDY_PLUGIN_WITH_STDLIB}" \
-DLIBCXXABI_ENABLE_WERROR=YES \
-DLIBUNWIND_ENABLE_WERROR=YES \
-DCMAKE_INSTALL_MESSAGE=NEVER \
Expand Down
Loading