From 515b4a4fdd7ac97373b68850a2ffa72e2b8e9178 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Thu, 8 May 2025 12:30:51 -0700 Subject: [clang][Darwin] Remove legacy framework search path logic in the frontend (#138234) Move the Darwin framework search path logic from InitHeaderSearch::AddDefaultIncludePaths to DarwinClang::AddClangSystemIncludeArgs. Add a new -internal-iframework cc1 argument to support the tool chain adding these paths. Now that the tool chain is adding search paths via cc1 flag, they're only added if they exist, so the Preprocessor/cuda-macos-includes.cu test is no longer relevant. Change Driver/driverkit-path.c and Driver/darwin-subframeworks.c to do -### style testing similar to the darwin-header-search and darwin-embedded-search-paths tests. Rename darwin-subframeworks.c to darwin-framework-search-paths.c and have it test all framework search paths, not just SubFrameworks. Add a unit test to validate that the myriad of search path flags result in the expected search path list. Fixes https://github.com/llvm/llvm-project/issues/75638 --- clang/lib/Frontend/CompilerInvocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index a0b8bbf..3945129 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3373,6 +3373,8 @@ static void GenerateHeaderSearchArgs(const HeaderSearchOptions &Opts, : OPT_internal_externc_isystem; GenerateArg(Consumer, Opt, It->Path); } + for (; It < End && Matches(*It, {frontend::System}, true, true); ++It) + GenerateArg(Consumer, OPT_internal_iframework, It->Path); assert(It == End && "Unhandled HeaderSearchOption::Entry."); @@ -3505,6 +3507,8 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args, Group = frontend::ExternCSystem; Opts.AddPath(A->getValue(), Group, false, true); } + for (const auto *A : Args.filtered(OPT_internal_iframework)) + Opts.AddPath(A->getValue(), frontend::System, true, true); // Add the path prefixes which are implicitly treated as being system headers. for (const auto *A : -- cgit v1.1