[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #120149)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 08:05:50 PST 2025


================
@@ -2539,6 +2550,18 @@ void DarwinClang::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs
     llvm::sys::path::append(P, "usr", "include");
     addExternCSystemInclude(DriverArgs, CC1Args, P.str());
   }
+
+  // Add default framework search paths
+  auto addFrameworkInclude = [&](auto ...Path) {
+    SmallString<128> P(Sysroot);
+    llvm::sys::path::append(P, Path...);
+
+    CC1Args.push_back("-internal-iframework");
+    CC1Args.push_back(DriverArgs.MakeArgString(P));
+  };
+  addFrameworkInclude("System", "Library", "Frameworks");
----------------
ldionne wrote:

I just tried refactoring into a static function and using the same for linker and headers, but there's a big mismatch between the two places we want to use the function from. Thus, we have to pass a ton of arguments to the newly-created `AddSearchPath` and they're not easy to derive (I still haven't figured out how to get the toolchain from `AddClangSystemIncludeArgs`).

I do agree that using the same arguments as `AddSearchPath` is an improvement though, and that's easy to do.

https://github.com/llvm/llvm-project/pull/120149


More information about the cfe-commits mailing list