2019-05-07 07:05:47 +00:00
|
|
|
include(CMakeDependentOption)
|
[clang-tools-extra][cmake] Use `GNUInstallDirs` to support custom installation dirs.
This is the original patch in my GNUInstallDirs series, now last to merge as the final piece!
It arose as a new draft of D28234. I initially did the unorthodox thing of pushing to that when I wasn't the original author, but since I ended up
- Using `GNUInstallDirs`, rather than mimicking it, as the original author was hesitant to do but others requested.
- Converting all the packages, not just LLVM, effecting many more projects than LLVM itself.
I figured it was time to make a new revision.
I have used this patch series (and many back-ports) as the basis of https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS), which was merged last spring (2021). It looked like people were generally on board in D28234, but I make note of this here in case extra motivation is useful.
---
As pointed out in the original issue, a central tension is that LLVM already has some partial support for these sorts of things. Variables like `COMPILER_RT_INSTALL_PATH` have already been dealt with. Variables like `LLVM_LIBDIR_SUFFIX` however, will require further work, so that we may use `CMAKE_INSTALL_LIBDIR`.
These remaining items will be addressed in further patches. What is here is now rote and so we should get it out of the way before dealing more intricately with the remainder.
Reviewed By: #libunwind, #libc, #libc_abi, compnerd
Differential Revision: https://reviews.llvm.org/D99484
2022-01-16 05:52:22 +00:00
|
|
|
include(GNUInstallDirs)
|
2019-05-07 07:05:47 +00:00
|
|
|
|
2020-09-03 23:37:29 +00:00
|
|
|
option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
|
|
|
|
"Include static analyzer checks in clang-tidy" ON)
|
|
|
|
|
2022-03-16 18:46:28 +00:00
|
|
|
if(CLANG_INCLUDE_TESTS)
|
|
|
|
umbrella_lit_testsuite_begin(check-clang-tools)
|
|
|
|
|
|
|
|
option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)
|
|
|
|
if(CLANG_TOOLS_TEST_USE_VG)
|
|
|
|
set_property(GLOBAL APPEND PROPERTY LLVM_CLANG_TOOLS_LIT_EXTRA_ARGS "--vg")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-09-03 17:58:19 +00:00
|
|
|
add_subdirectory(clang-apply-replacements)
|
2016-09-02 02:56:07 +00:00
|
|
|
add_subdirectory(clang-reorder-fields)
|
2013-09-04 17:35:07 +00:00
|
|
|
add_subdirectory(modularize)
|
2014-07-14 22:15:29 +00:00
|
|
|
add_subdirectory(clang-tidy)
|
|
|
|
|
2019-03-15 11:54:01 +00:00
|
|
|
add_subdirectory(clang-change-namespace)
|
2018-03-22 23:34:46 +00:00
|
|
|
add_subdirectory(clang-doc)
|
2019-03-25 14:09:10 +00:00
|
|
|
add_subdirectory(clang-include-fixer)
|
[clang-move] A prototype tool for moving class definition to new file.
Summary:
This patch introduces a new tool which moves a specific class definition
from files (.h, .cc) to new files (.h, .cc), which mostly acts like
"Extract class defintion". In the long term, this tool should be
merged in to clang-refactoring as a subtool.
clang-move not only moves class definition, but also moves all the
forward declarations, functions defined in anonymous namespace and #include
headers to new files, to make sure the new files are compliable as much
as possible.
To move `Foo` from old.[h/cc] to new.[h/cc], use:
```
clang-move -name=Foo -old_header=old.h -old_cc=old.cc -new_header=new.h
-new_cc=new.cc old.cc
```
To move `Foo` from old.h to new.h, use:
```
clang-move -name=Foo -old_header=old.h -new_header=new.h old.cc
```
Reviewers: klimek, djasper, ioeric
Subscribers: mgorny, beanz, Eugene.Zelenko, bkramer, omtcyfz, cfe-commits
Differential Revision: https://reviews.llvm.org/D24243
llvm-svn: 282070
2016-09-21 13:18:19 +00:00
|
|
|
add_subdirectory(clang-move)
|
2019-03-25 14:09:10 +00:00
|
|
|
add_subdirectory(clang-query)
|
[include-cleaner] Include-cleaner library structure, and simplistic AST walking.
Include-cleaner is a library that uses the clang AST and preprocessor to
determine which headers are used. It will be used in clang-tidy, in
clangd, in a standalone tool at least for testing, and in out-of-tree tools.
Roughly, it walks the AST, finds referenced decls, maps these to
used sourcelocations, then to FileEntrys, then matching these against #includes.
However there are many wrinkles: dealing with macros, standard library
symbols, umbrella headers, IWYU directives etc.
It is not built on the C++20 modules concept of usage, to allow:
- use with existing non-modules codebases
- a flexible API embeddable in clang-tidy, clangd, and other tools
- avoiding a chicken-and-egg problem where include cleanups are needed
before modules can be adopted
This library is based on existing functionality in clangd that provides
an unused-include warning. However it has design changes:
- it accommodates diagnosing missing includes too (this means tracking
where references come from, not just the set of targets)
- it more clearly separates the different mappings
(symbol => location => header => include) for better testing
- it handles special cases like standard library symbols and IWYU directives
more elegantly by adding unified Location and Header types instead of
side-tables
- it will support some customization of policy where necessary (e.g.
for style questions of what constitutes a use, or to allow
both missing-include and unused-include modes to be conservative)
This patch adds the basic directory structure under clang-tools-extra
and a skeleton version of the AST traversal, which will be the central
piece.
A more end-to-end prototype is in https://reviews.llvm.org/D122677
RFC: https://discourse.llvm.org/t/rfc-lifting-include-cleaner-missing-unused-include-detection-out-of-clangd/61228
Differential Revision: https://reviews.llvm.org/D124164
2022-04-13 19:13:34 +00:00
|
|
|
add_subdirectory(include-cleaner)
|
2014-07-14 22:15:29 +00:00
|
|
|
add_subdirectory(pp-trace)
|
2022-03-16 00:08:02 +00:00
|
|
|
add_subdirectory(pseudo)
|
2013-09-04 17:35:07 +00:00
|
|
|
add_subdirectory(tool-template)
|
2012-08-07 08:33:04 +00:00
|
|
|
|
2016-01-27 11:37:08 +00:00
|
|
|
option(CLANG_TOOLS_EXTRA_INCLUDE_DOCS "Generate build targets for the Clang Extra Tools docs."
|
|
|
|
${LLVM_INCLUDE_DOCS})
|
|
|
|
if( CLANG_TOOLS_EXTRA_INCLUDE_DOCS )
|
|
|
|
add_subdirectory(docs)
|
|
|
|
endif()
|
|
|
|
|
2019-05-07 07:05:47 +00:00
|
|
|
# clangd has its own CMake tree. It requires threads.
|
|
|
|
CMAKE_DEPENDENT_OPTION(CLANG_ENABLE_CLANGD "Build clangd language server" ON
|
|
|
|
"LLVM_ENABLE_THREADS" OFF)
|
|
|
|
if (CLANG_ENABLE_CLANGD)
|
|
|
|
add_subdirectory(clangd)
|
|
|
|
endif()
|
2022-03-16 18:46:28 +00:00
|
|
|
|
|
|
|
# Add the common testsuite after all the tools.
|
|
|
|
if(CLANG_INCLUDE_TESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
add_subdirectory(unittests)
|
|
|
|
umbrella_lit_testsuite_end(check-clang-tools)
|
|
|
|
endif()
|