diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt --- a/clang-tools-extra/test/CMakeLists.txt +++ b/clang-tools-extra/test/CMakeLists.txt @@ -17,7 +17,6 @@ llvm_canonicalize_cmake_booleans( CLANG_TIDY_ENABLE_STATIC_ANALYZER - LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA ) configure_lit_site_cfg( @@ -68,10 +67,6 @@ # Clang-tidy tests need clang for building modules. clang ) -if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA) - # For the clang-tidy libclang integration test. - set(CLANG_TOOLS_TEST_DEPS ${CLANG_TOOLS_TEST_DEPS} "c-index-test") -endif () # Add lit test dependencies. set(LLVM_UTILS_DEPS diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp deleted file mode 100644 --- a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// REQUIRES: static-analyzer, libclang_include_clang_tools_extra -// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*,google-explicit-constructor,clang-diagnostic-unused-variable,clang-analyzer-core.UndefinedBinaryOperatorResult' -Wunused-variable -I%S/Inputs/nolint 2>&1 | FileCheck %s - -#include "trigger_warning.h" -void I(int& Out) { - int In; - A1(In, Out); -} -// CHECK-NOT: trigger_warning.h:{{.*}} warning -// CHECK-NOT: :[[@LINE-4]]:{{.*}} note - -class A { A(int i); }; -// CHECK-DAG: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -class B { B(int i); }; // NOLINT - -class C { C(int i); }; // NOLINT(for-some-other-check) -// CHECK-DAG: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -class C1 { C1(int i); }; // NOLINT(*) - -class C2 { C2(int i); }; // NOLINT(not-closed-bracket-is-treated-as-skip-all - -class C3 { C3(int i); }; // NOLINT(google-explicit-constructor) - -class C4 { C4(int i); }; // NOLINT(some-check, google-explicit-constructor) - -class C5 { C5(int i); }; // NOLINT without-brackets-skip-all, another-check - -void f() { - int i; -// CHECK-DAG: :[[@LINE-1]]:7: warning: unused variable 'i' [-Wunused-variable] -// 31:7: warning: unused variable 'i' [-Wunused-variable] -// int j; // NOLINT -// int k; // NOLINT(clang-diagnostic-unused-variable) -} - -#define MACRO(X) class X { X(int i); }; -MACRO(D) -// CHECK-DAG: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit -MACRO(E) // NOLINT - -#define MACRO_NOARG class F { F(int i); }; -MACRO_NOARG // NOLINT - -#define MACRO_NOLINT class G { G(int i); }; // NOLINT -MACRO_NOLINT - -#define DOUBLE_MACRO MACRO(H) // NOLINT -DOUBLE_MACRO diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp deleted file mode 100644 --- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// REQUIRES: libclang_include_clang_tools_extra -// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*,google-explicit-constructor' 2>&1 | FileCheck %s - -class A { A(int i); }; -// CHECK: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -// NOLINTNEXTLINE -class B { B(int i); }; - -// NOLINTNEXTLINE(for-some-other-check) -class C { C(int i); }; -// CHECK: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -// NOLINTNEXTLINE(*) -class C1 { C1(int i); }; - -// NOLINTNEXTLINE(not-closed-bracket-is-treated-as-skip-all -class C2 { C2(int i); }; - -// NOLINTNEXTLINE(google-explicit-constructor) -class C3 { C3(int i); }; - -// NOLINTNEXTLINE(some-check, google-explicit-constructor) -class C4 { C4(int i); }; - -// NOLINTNEXTLINE without-brackets-skip-all, another-check -class C5 { C5(int i); }; - - -// NOLINTNEXTLINE - -class D { D(int i); }; -// CHECK: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -// NOLINTNEXTLINE -// -class E { E(int i); }; -// CHECK: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit - -#define MACRO(X) class X { X(int i); }; -MACRO(F) -// CHECK: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit -// NOLINTNEXTLINE -MACRO(G) - -#define MACRO_NOARG class H { H(int i); }; -// NOLINTNEXTLINE -MACRO_NOARG - diff --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in --- a/clang-tools-extra/test/lit.site.cfg.py.in +++ b/clang-tools-extra/test/lit.site.cfg.py.in @@ -11,7 +11,6 @@ config.python_executable = "@Python3_EXECUTABLE@" config.target_triple = "@TARGET_TRIPLE@" config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@ -config.libclang_include_clang_tools_extra = @LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA@ # 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. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -151,6 +151,10 @@ These are major changes to the build system that have happened since the 12.0.0 release of Clang. Users of the build system should adjust accordingly. +- The option ``LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA`` no longer exists. There were + two releases with that flag forced off, and no uses were added that forced it + on. The recommended replacement is clangd. + - ... AST Matchers diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -9161,16 +9161,3 @@ OS << "--------------------------------------------------\n"; } } - -#ifdef CLANG_TOOL_EXTRA_BUILD -// This anchor is used to force the linker to link the clang-tidy plugin. -extern volatile int ClangTidyPluginAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination = - ClangTidyPluginAnchorSource; - -// This anchor is used to force the linker to link the clang-include-fixer -// plugin. -extern volatile int ClangIncludeFixerPluginAnchorSource; -static int LLVM_ATTRIBUTE_UNUSED ClangIncludeFixerPluginAnchorDestination = - ClangIncludeFixerPluginAnchorSource; -#endif diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -52,22 +52,6 @@ list(APPEND LIBS clangARCMigrate) 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 () - if (HAVE_LIBDL) list(APPEND LIBS ${CMAKE_DL_LIBS}) elseif (CLANG_BUILT_STANDALONE) diff --git a/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn --- a/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn +++ b/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn @@ -1,6 +1,5 @@ import("//clang-tools-extra/clang-tidy/enable.gni") import("//clang/lib/StaticAnalyzer/Frontend/enable.gni") -import("//clang/tools/libclang/include_clang_tools_extra.gni") import("//llvm/triples.gni") import("//llvm/utils/gn/build/write_cmake_config.gni") import("clang_tools_extra_lit_site_cfg_files.gni") @@ -44,12 +43,6 @@ } else { extra_values += [ "CLANG_TIDY_ENABLE_STATIC_ANALYZER=0" ] } - - if (libclang_include_clang_tools_extra) { - extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=1" ] - } else { - extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=0" ] - } } write_lit_config("lit_unit_site_cfg") { diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn --- a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn @@ -1,5 +1,4 @@ import("//clang/lib/ARCMigrate/enable.gni") -import("//clang/tools/libclang/include_clang_tools_extra.gni") import("//llvm/version.gni") # This build file is just enough to get check-clang to pass, it's missing @@ -40,16 +39,6 @@ defines = [] - # 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. - if (libclang_include_clang_tools_extra) { - defines += [ "CLANG_TOOL_EXTRA_BUILD" ] - deps += [ - "//clang-tools-extra/clang-include-fixer/plugin", - "//clang-tools-extra/clang-tidy/plugin", - ] - } - if (host_os == "win") { defines += [ "_CINDEX_LIB_" ] } diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni b/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni deleted file mode 100644 --- a/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni +++ /dev/null @@ -1,4 +0,0 @@ -declare_args() { - # Whether to include code from clang-tools-extra in libclang. - libclang_include_clang_tools_extra = false -}