mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
3c68509ca3
Ported from clangd, this still can be improved over time, but it can be landed. This was based on the work from https://bit.ly/3TkV2N1 * The utility makes the assumption that all header are self contained! * It only checkes `Decls` from the main translation file, where SourceLocarion is the passed `cpp` file. * It builds a list with all of the includes from the translation unit. * It matches all of the `Decls` from the main translation units with definitions from the included header files and builds a list with used header files. * All of the includes that are not part of the matched used header files are considered to be unused. Of course this is correct if the first assumption if followed by the coding guide, where all of the header are self contained. Since the mozilla code base doesn't follow this approach false positives might appear where the is the following situation: FOO.cpp #include <A> #Include <B> If header `A` defines a symbol that is used by header `B` and `B` doesn't include `A` nor it has symbols defined that are used by `FOO.cpp` then `B` it will be marked as potentially to be removed by the tool. This is the limitation determined by header that are not self contained. The limitation presented above can be fixed in the future with extra work, but it's very time expensive during the runtime of the checker. Differential Revision: https://phabricator.services.mozilla.com/D161583 |
||
---|---|---|
.. | ||
1stage.json | ||
2stages.json | ||
4stages-pgo.json | ||
android-mangling-error_clang_12.patch | ||
bug47258-extract-symbols-mbcs.patch | ||
build-clang.py | ||
clang_include_cleaner.patch | ||
clang-5.0.json | ||
clang-14.json | ||
clang-15.json | ||
clang-tidy-ci.patch | ||
clang-tidy-external-linux64.json | ||
clang-tidy-linux64.json | ||
clang-tidy-macosx64.json | ||
clang-tidy-win64.json | ||
clang-trunk.json | ||
compiler-rt-no-codesign.patch | ||
compiler-rt-rss-limit-heap-profile.patch | ||
downgrade-mangling-error_clang_12.patch | ||
find_symbolizer_linux_clang_10.patch | ||
find_symbolizer_linux_clang_15.patch | ||
fuzzing_ccov_build_clang_12.patch | ||
linux64.json | ||
llvmorg-15-init-16512-g4b1e3d193706.patch | ||
llvmorg-16-init-7778-g232e0a011e8c.patch | ||
llvmorg-16-init-10850-gff111a997f1b.patch | ||
macosx64.json | ||
profdata-compat.patch | ||
profile-g4a10504e1f70c.patch | ||
profile.json | ||
README | ||
Remove-FlushViewOfFile-when-unmaping-gcda-files.patch | ||
revert-llvmorg-14-init-3651-g85ba583eba19.patch | ||
revert-llvmorg-14-init-3652-gf3c2094d8c11.patch | ||
revert-llvmorg-14-init-11890-gf86deb18cab6_clang_16.patch | ||
revert-llvmorg-14-init-11890-gf86deb18cab6.patch | ||
revert-llvmorg-14-init-14141-gd6d3000a2f6d.patch | ||
revert-llvmorg-15-init-11205-gcead4eceb01b.patch | ||
revert-llvmorg-15-init-13446-g7524fe962e47.patch | ||
revert-llvmorg-16-init-7598-g54bfd0484615.patch | ||
revert-llvmorg-16-init-7694-g19e984ef8f49.patch | ||
revert-llvmorg-16-init-8201-ge0fb01e97b6b.patch | ||
revert-llvmorg-16-init-9324-g01859da84bad.patch | ||
skip-3-stages.json | ||
skip-stage-1-win64.json | ||
skip-stage-1.json | ||
tsan-D101154.patch | ||
unpoison-thread-stacks_clang_10.patch | ||
win64-no-symlink_clang_16.patch | ||
win64-no-symlink.patch | ||
win64-ret-null-on-commitment-limit_clang_14.patch | ||
win64.json |
build-clang.py ============== A script to build clang from source. ``` usage: build-clang.py [-h] -c CONFIG [--clean] optional arguments: -h, --help show this help message and exit -c CONFIG, --config CONFIG Clang configuration file --clean Clean the build directory ``` Pre-requisites -------------- * Working build toolchain. * git * CMake * Ninja * Python 2.7 and 3 Please use the latest available CMake for your platform to avoid surprises. Config file format ------------------ build-clang.py accepts a JSON config format with the following fields: * stages: Use 1, 2, 3 or 4 to select different compiler stages. The default is 2. * cc: Path to the bootsraping C Compiler. * cxx: Path to the bootsraping C++ Compiler. * as: Path to the assembler tool. * ar: Path to the library archiver tool. * ranlib: Path to the ranlib tool (optional). * libtool: Path to the libtool tool (optional). * ld: Path to the linker. * patches: Optional list of patches to apply. * build_type: The type of build to make. Supported types: Release, Debug, RelWithDebInfo or MinSizeRel. * targets: The targets supported by the final stage LLVM/clang. * build_clang_tidy: Whether to build clang-tidy with the Mozilla checks imported. The default is false. * osx_cross_compile: Whether to invoke CMake for OS X cross compile builds. * assertions: Whether to enable LLVM assertions. The default is false. * pgo: Whether to build with PGO (requires stages == 4). The default is false. The revisions are defined in taskcluster/ci/fetch/toolchains.yml. They are usually commit sha1s corresponding to upstream tags. Environment Variables --------------------- The following environment variables are used for cross-compile builds targeting OS X on Linux. * CROSS_CCTOOLS_PATH: Path to the cctools directory where the cross compiler toolchain is located. * CROSS_SYSROOT: Path to the OS X SDK directory for cross compile builds.