The branch stable/14 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=1821af77efefd25ecdade590074f21fa976d086f
commit 1821af77efefd25ecdade590074f21fa976d086f Author: Lexi Winter <i...@freebsd.org> AuthorDate: 2025-07-06 20:42:58 +0000 Commit: Lexi Winter <i...@freebsd.org> CommitDate: 2025-07-11 03:11:48 +0000 clang: install clang-scan-deps clang-scan-deps is used to generate dependency information from C++20 modules according to proposed standard ISO/IEC WG21 P1689R5[0]. It is required by common build tools (e.g., CMake) to build C++ sources that use modules. Since this is a core build tool, install it by default, not gated behind MK_CLANG_EXTRAS. [0] https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2022/p1689r5.html MFC after: 3 days Reviewed by: kevans, dim Approved by: kevans (mentor) Requested by: jbo Differential Revision: https://reviews.freebsd.org/D51044 (cherry picked from commit d3c06bed2c16b434dd49958dee5de8c55ad00b85) --- lib/clang/libclang/Makefile | 6 +++++ usr.bin/clang/Makefile | 4 ++++ usr.bin/clang/clang-scan-deps/Makefile | 26 ++++++++++++++++++++++ .../clang-scan-deps/clang-scan-deps-driver.cpp | 18 +++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile index 5e20b37c1183..9b9e0cbadcd7 100644 --- a/lib/clang/libclang/Makefile +++ b/lib/clang/libclang/Makefile @@ -842,6 +842,11 @@ SRCS_MIN+= Tooling/ArgumentsAdjusters.cpp SRCS_MIN+= Tooling/CommonOptionsParser.cpp SRCS_MIN+= Tooling/CompilationDatabase.cpp SRCS_MIN+= Tooling/Core/Replacement.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningFilesystem.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningService.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningTool.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningWorker.cpp +SRCS_MIN+= Tooling/DependencyScanning/ModuleDepCollector.cpp SRCS_MIN+= Tooling/ExpandResponseFilesCompilationDatabase.cpp SRCS_MIN+= Tooling/FileMatchTrie.cpp SRCS_MIN+= Tooling/GuessTargetAndModeCompilationDatabase.cpp @@ -849,6 +854,7 @@ SRCS_MIN+= Tooling/Inclusions/HeaderIncludes.cpp SRCS_MIN+= Tooling/Inclusions/IncludeStyle.cpp SRCS_MIN+= Tooling/InterpolatingCompilationDatabase.cpp SRCS_MIN+= Tooling/JSONCompilationDatabase.cpp +SRCS_MIN+= Tooling/LocateToolCompilationDatabase.cpp SRCS_MIN+= Tooling/Refactoring.cpp SRCS_MIN+= Tooling/RefactoringCallbacks.cpp SRCS_MIN+= Tooling/Tooling.cpp diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index 30ec1ab65e0f..d883048b7ed9 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -6,6 +6,10 @@ SUBDIR+= clang .endif .if !defined(TOOLS_PREFIX) +.if ${MK_CLANG} != "no" +SUBDIR+= clang-scan-deps +.endif + # LLVM binutils are needed to support features such as LTO, so we build them # by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them # as the default binutils (ar,nm,addr2line, etc.). diff --git a/usr.bin/clang/clang-scan-deps/Makefile b/usr.bin/clang/clang-scan-deps/Makefile new file mode 100644 index 000000000000..16fecdb88867 --- /dev/null +++ b/usr.bin/clang/clang-scan-deps/Makefile @@ -0,0 +1,26 @@ +.include <src.opts.mk> + +PROG_CXX= clang-scan-deps +MAN= + +SRCDIR= clang/tools/clang-scan-deps +SRCS+= ClangScanDeps.cpp \ + clang-scan-deps-driver.cpp + +.include "${SRCTOP}/lib/clang/clang.pre.mk" + +CFLAGS+= -I${.OBJDIR} +TDFILE= Opts.td +INCFILE= ${TDFILE:.td=.inc} +GENOPT= -gen-opt-parser-defs + +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${.ALLSRC} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.include "../clang.prog.mk" diff --git a/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp new file mode 100644 index 000000000000..f941cc434ff6 --- /dev/null +++ b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp @@ -0,0 +1,18 @@ +//===-- driver-template.cpp -----------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/LLVMDriver.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/InitLLVM.h" + +int clang_scan_deps_main(int argc, char **, const llvm::ToolContext &); + +int main(int argc, char **argv) { + llvm::InitLLVM X(argc, argv); + return clang_scan_deps_main(argc, argv, {argv[0], nullptr, false}); +}