[PATCH] D79599: Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 09:05:47 PDT 2020
This revision was automatically updated to reflect the committed changes.
thakis marked an inline comment as done.
Closed by commit rGe9b411390285: Add a flag that controls if clang-tidy and clang-include-fixer are built into… (authored by thakis).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D79599?vs=262758&id=262885#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79599/new/
https://reviews.llvm.org/D79599
Files:
clang/docs/ReleaseNotes.rst
clang/tools/libclang/CMakeLists.txt
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
Index: llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -9,6 +9,11 @@
# in the CMake build), so libclang is always a static library on linux
# - the GN build doesn't have LIBCLANG_BUILD_STATIC
+declare_args() {
+ # Whether to include code from clang-tools-extra in libclang.
+ libclang_include_clang_tools_extra = false
+}
+
libclang_target_type = "shared_library"
if (host_os != "win" && host_os != "mac") {
# ELF targets need -fPIC to build shared libs but they aren't on by default.
@@ -41,9 +46,7 @@
# FIXME: Once the GN build has a way to select which bits to build,
# only include this dependency if clang-tools-extra is part of the build.
- # FIXME: libclang depending on anything in clang-tools-extra seems like
- # a layering violation.
- if (true) {
+ if (libclang_include_clang_tools_extra) {
defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
deps += [
"//clang-tools-extra/clang-include-fixer/plugin",
Index: clang/tools/libclang/CMakeLists.txt
===================================================================
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -50,13 +50,20 @@
list(APPEND LIBS clangARCMigrate)
endif ()
-if (TARGET clangTidyPlugin)
- add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
- list(APPEND LIBS clangTidyPlugin)
- list(APPEND LIBS clangIncludeFixerPlugin)
- if(LLVM_ENABLE_MODULES)
- list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
- endif()
+option(LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
+ "Include code from clang-tools-extra in libclang." OFF)
+
+if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
+ if (TARGET clangTidyPlugin)
+ add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+ list(APPEND LIBS clangTidyPlugin)
+ list(APPEND LIBS clangIncludeFixerPlugin)
+ if(LLVM_ENABLE_MODULES)
+ list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+ endif()
+ else ()
+ message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs clang-tools-extra in LLVM_ENABLE_PROJECTS")
+ endif ()
endif ()
find_library(DL_LIBRARY_PATH dl)
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -240,7 +240,11 @@
These are major changes to the build system that have happened since the 10.0.0
release of Clang. Users of the build system should adjust accordingly.
-- ...
+- clang-tidy and clang-include-fixer are no longer compiled into libclang by
+ default. You can set ``LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=ON`` to undo that,
+ but it's expected that that setting will go away eventually. If this is
+ something you need, please reach out to the mailing list to discuss possible
+ ways forward.
AST Matchers
------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79599.262885.patch
Type: text/x-patch
Size: 3005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200508/d9309406/attachment.bin>
More information about the llvm-commits
mailing list