Skip to content

Commit 52b8e10

Browse files
committed
[libclang] Remove LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA causes clang-tools-extra tools to be included in libclang, which caused a dependency cycle. The option has been off by default for two releases now, and (based on a web search and mailing list feedback) nobody seems to turn it on. Remove it, like planned on https://reviews.llvm.org/D79599 Differential Revision: https://reviews.llvm.org/D97693
1 parent 3f40dbb commit 52b8e10

File tree

10 files changed

+4
-156
lines changed

10 files changed

+4
-156
lines changed

clang-tools-extra/test/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUN
1717

1818
llvm_canonicalize_cmake_booleans(
1919
CLANG_TIDY_ENABLE_STATIC_ANALYZER
20-
LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
2120
)
2221

2322
configure_lit_site_cfg(
@@ -68,10 +67,6 @@ set(CLANG_TOOLS_TEST_DEPS
6867
# Clang-tidy tests need clang for building modules.
6968
clang
7069
)
71-
if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
72-
# For the clang-tidy libclang integration test.
73-
set(CLANG_TOOLS_TEST_DEPS ${CLANG_TOOLS_TEST_DEPS} "c-index-test")
74-
endif ()
7570

7671
# Add lit test dependencies.
7772
set(LLVM_UTILS_DEPS

clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

clang-tools-extra/test/lit.site.cfg.py.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ config.clang_libs_dir = "@SHLIBDIR@"
1111
config.python_executable = "@Python3_EXECUTABLE@"
1212
config.target_triple = "@TARGET_TRIPLE@"
1313
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
14-
config.libclang_include_clang_tools_extra = @LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA@
1514

1615
# Support substitution of the tools and libs dirs with user parameters. This is
1716
# used when we can't determine the tool dir at configuration time.

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ Build System Changes
151151
These are major changes to the build system that have happened since the 12.0.0
152152
release of Clang. Users of the build system should adjust accordingly.
153153

154+
- The option ``LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA`` no longer exists. There were
155+
two releases with that flag forced off, and no uses were added that forced it
156+
on. The recommended replacement is clangd.
157+
154158
- ...
155159

156160
AST Matchers

clang/tools/libclang/CIndex.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9161,16 +9161,3 @@ cxindex::Logger::~Logger() {
91619161
OS << "--------------------------------------------------\n";
91629162
}
91639163
}
9164-
9165-
#ifdef CLANG_TOOL_EXTRA_BUILD
9166-
// This anchor is used to force the linker to link the clang-tidy plugin.
9167-
extern volatile int ClangTidyPluginAnchorSource;
9168-
static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination =
9169-
ClangTidyPluginAnchorSource;
9170-
9171-
// This anchor is used to force the linker to link the clang-include-fixer
9172-
// plugin.
9173-
extern volatile int ClangIncludeFixerPluginAnchorSource;
9174-
static int LLVM_ATTRIBUTE_UNUSED ClangIncludeFixerPluginAnchorDestination =
9175-
ClangIncludeFixerPluginAnchorSource;
9176-
#endif

clang/tools/libclang/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ if (CLANG_ENABLE_ARCMT)
5252
list(APPEND LIBS clangARCMigrate)
5353
endif ()
5454

55-
option(LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
56-
"Include code from clang-tools-extra in libclang." OFF)
57-
58-
if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
59-
if (TARGET clangTidyPlugin)
60-
add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
61-
list(APPEND LIBS clangTidyPlugin)
62-
list(APPEND LIBS clangIncludeFixerPlugin)
63-
if(LLVM_ENABLE_MODULES)
64-
list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
65-
endif()
66-
else ()
67-
message(FATAL_ERROR "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA needs clang-tools-extra in LLVM_ENABLE_PROJECTS")
68-
endif ()
69-
endif ()
70-
7155
if (HAVE_LIBDL)
7256
list(APPEND LIBS ${CMAKE_DL_LIBS})
7357
elseif (CLANG_BUILT_STANDALONE)

llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import("//clang-tools-extra/clang-tidy/enable.gni")
22
import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
3-
import("//clang/tools/libclang/include_clang_tools_extra.gni")
43
import("//llvm/triples.gni")
54
import("//llvm/utils/gn/build/write_cmake_config.gni")
65
import("clang_tools_extra_lit_site_cfg_files.gni")
@@ -44,12 +43,6 @@ write_lit_config("lit_site_cfg") {
4443
} else {
4544
extra_values += [ "CLANG_TIDY_ENABLE_STATIC_ANALYZER=0" ]
4645
}
47-
48-
if (libclang_include_clang_tools_extra) {
49-
extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=1" ]
50-
} else {
51-
extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=0" ]
52-
}
5346
}
5447

5548
write_lit_config("lit_unit_site_cfg") {

llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import("//clang/lib/ARCMigrate/enable.gni")
2-
import("//clang/tools/libclang/include_clang_tools_extra.gni")
32
import("//llvm/version.gni")
43

54
# This build file is just enough to get check-clang to pass, it's missing
@@ -40,16 +39,6 @@ target(libclang_target_type, "libclang") {
4039

4140
defines = []
4241

43-
# FIXME: Once the GN build has a way to select which bits to build,
44-
# only include this dependency if clang-tools-extra is part of the build.
45-
if (libclang_include_clang_tools_extra) {
46-
defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
47-
deps += [
48-
"//clang-tools-extra/clang-include-fixer/plugin",
49-
"//clang-tools-extra/clang-tidy/plugin",
50-
]
51-
}
52-
5342
if (host_os == "win") {
5443
defines += [ "_CINDEX_LIB_" ]
5544
}

llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)