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

>From ac165075f270af65395a3709a1457b61ed97ea31 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Mon, 16 Dec 2024 13:28:38 -0500
Subject: [PATCH 1/6] [clang][Darwin] Remove legacy framework search path logic
 in the frontend

This removes a long standing piece of technical debt. Most other platforms
have moved all their header search path logic to the driver, but Darwin
still had some logic for setting framework search paths present in the
frontend. This patch moves that logic to the driver alongside existing
logic that already handles part of these search paths.

To achieve parity with the previous search path order, this patch
introduces the -internal-iframework flag which is used to pass
system framework paths from the driver to the frontend. These paths
are handled specially in that they are added after normal framework
search paths, which preserves the old frontend behavior for system
frameworks.

This patch is a re-application of 
https://github.com/llvm/llvm-project/pull/75841
which was reverted in d34901f30 because it broke framework search paths.
In fact, the original patch was only adding framework search paths to
the linker job, but was not adding search paths for finding headers.
That issue is resolved in this version of the patch, with added tests.

Fixes #75638
---
 clang/include/clang/Driver/Options.td         |  5 ++
 clang/lib/Driver/Job.cpp                      |  2 +-
 clang/lib/Driver/ToolChains/Darwin.cpp        | 49 ++++++++++++++-----
 clang/lib/Frontend/CompilerInvocation.cpp     |  7 ++-
 clang/lib/Lex/InitHeaderSearch.cpp            | 19 ++-----
 .../Driver/darwin-framework-search-paths.c    | 26 ++++++++++
 clang/test/Driver/darwin-subframeworks.c      | 18 -------
 .../test/Preprocessor/cuda-macos-includes.cu  | 13 ++---
 8 files changed, 79 insertions(+), 60 deletions(-)
 create mode 100644 clang/test/Driver/darwin-framework-search-paths.c
 delete mode 100644 clang/test/Driver/darwin-subframeworks.c

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 0528104f055158..8fa811845dfbcc 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8298,6 +8298,11 @@ def internal_externc_isystem : Separate<["-"], 
"internal-externc-isystem">,
            "implicit extern \"C\" semantics; these are assumed to not be "
            "user-provided and are used to model system and standard headers' "
            "paths.">;
+def internal_iframework : Separate<["-"], "internal-iframework">,
+  MetaVarName<"<directory>">,
+  HelpText<"Add directory to the internal system framework include search 
path; these "
+           "are assumed to not be user-provided and are used to model system "
+           "and standard frameworks' paths.">;
 
 } // let Visibility = [CC1Option]
 
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index ae2f1cd1f56c99..07d2d371c5626b 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -73,7 +73,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int 
&SkipNum,
     .Cases("-internal-externc-isystem", "-iprefix", true)
     .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
     .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
-    .Cases("-iframework", "-include-pch", true)
+    .Cases("-internal-iframework", "-iframework", "-include-pch", true)
     .Default(false);
   if (IsInclude)
     return !HaveCrashVFS;
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 56b6dd78673cb6..19fd4dc148da73 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -800,9 +800,15 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
     }
   }
 
-  // Add non-standard, platform-specific search paths, e.g., for DriverKit:
-  //  -L<sysroot>/System/DriverKit/usr/lib
-  //  -F<sysroot>/System/DriverKit/System/Library/Framework
+  // Add framework include paths and library search paths.
+  // There are two flavors:
+  // 1. The "non-standard" paths, e.g. for DriverKit:
+  //      -L<sysroot>/System/DriverKit/usr/lib
+  //      -F<sysroot>/System/DriverKit/System/Library/Frameworks
+  // 2. The "standard" paths, e.g. for macOS and iOS:
+  //      -F<sysroot>/System/Library/Frameworks
+  //      -F<sysroot>/System/Library/SubFrameworks
+  //      -F<sysroot>/Library/Frameworks
   {
     bool NonStandardSearchPath = false;
     const auto &Triple = getToolChain().getTriple();
@@ -813,18 +819,23 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
           (Version.getMajor() == 605 && Version.getMinor().value_or(0) < 1);
     }
 
-    if (NonStandardSearchPath) {
-      if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
-        auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
-          SmallString<128> P(Sysroot->getValue());
-          AppendPlatformPrefix(P, Triple);
-          llvm::sys::path::append(P, SearchPath);
-          if (getToolChain().getVFS().exists(P)) {
-            CmdArgs.push_back(Args.MakeArgString(Flag + P));
-          }
-        };
+    if (auto *Sysroot = Args.getLastArg(options::OPT_isysroot)) {
+      auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
+        SmallString<128> P(Sysroot->getValue());
+        AppendPlatformPrefix(P, Triple);
+        llvm::sys::path::append(P, SearchPath);
+        if (getToolChain().getVFS().exists(P)) {
+          CmdArgs.push_back(Args.MakeArgString(Flag + P));
+        }
+      };
+
+      if (NonStandardSearchPath) {
         AddSearchPath("-L", "/usr/lib");
         AddSearchPath("-F", "/System/Library/Frameworks");
+      } else if (!Triple.isDriverKit()) {
+        AddSearchPath("-F", "/System/Library/Frameworks");
+        AddSearchPath("-F", "/System/Library/SubFrameworks");
+        AddSearchPath("-F", "/Library/Frameworks");
       }
     }
   }
@@ -2547,6 +2558,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");
+  addFrameworkInclude("System", "Library", "SubFrameworks");
+  addFrameworkInclude("Library", "Frameworks");
 }
 
 bool DarwinClang::AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList 
&DriverArgs,
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index d711df02ce9503..fd6f386f3f66fd 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3436,11 +3436,14 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions 
&Opts, ArgList &Args,
 
   // Add the internal paths from a driver that detects standard include paths.
   for (const auto *A :
-       Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
+       Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem, 
OPT_internal_iframework)) {
     frontend::IncludeDirGroup Group = frontend::System;
+    bool IsFramework = false;
     if (A->getOption().matches(OPT_internal_externc_isystem))
       Group = frontend::ExternCSystem;
-    Opts.AddPath(A->getValue(), Group, false, true);
+    if (A->getOption().matches(OPT_internal_iframework))
+      IsFramework = true;
+    Opts.AddPath(A->getValue(), Group, IsFramework, true);
   }
 
   // Add the path prefixes which are implicitly treated as being system 
headers.
diff --git a/clang/lib/Lex/InitHeaderSearch.cpp 
b/clang/lib/Lex/InitHeaderSearch.cpp
index 67c9d92b849ea3..6567ad6afb5619 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -321,6 +321,9 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
     break;
   }
 
+  if (triple.isOSDarwin())
+    return false;
+
   return true; // Everything else uses AddDefaultIncludePaths().
 }
 
@@ -335,22 +338,6 @@ void InitHeaderSearch::AddDefaultIncludePaths(
   if (!ShouldAddDefaultIncludePaths(triple))
     return;
 
-  // NOTE: some additional header search logic is handled in the driver for
-  // Darwin.
-  if (triple.isOSDarwin()) {
-    if (HSOpts.UseStandardSystemIncludes) {
-      // Add the default framework include paths on Darwin.
-      if (triple.isDriverKit()) {
-        AddPath("/System/DriverKit/System/Library/Frameworks", System, true);
-      } else {
-        AddPath("/System/Library/Frameworks", System, true);
-        AddPath("/System/Library/SubFrameworks", System, true);
-        AddPath("/Library/Frameworks", System, true);
-      }
-    }
-    return;
-  }
-
   if (Lang.CPlusPlus && !Lang.AsmPreprocessor &&
       HSOpts.UseStandardCXXIncludes && HSOpts.UseStandardSystemIncludes) {
     if (HSOpts.UseLibcxx) {
diff --git a/clang/test/Driver/darwin-framework-search-paths.c 
b/clang/test/Driver/darwin-framework-search-paths.c
new file mode 100644
index 00000000000000..4bfe269f8d903d
--- /dev/null
+++ b/clang/test/Driver/darwin-framework-search-paths.c
@@ -0,0 +1,26 @@
+// UNSUPPORTED: system-windows
+//   Windows is unsupported because we use the Unix path separator `/` in the 
test.
+
+// Add default directories before running clang to check default
+// search paths.
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: cp -R %S/Inputs/MacOSX15.1.sdk %t/
+// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/Frameworks
+// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/SubFrameworks
+// RUN: mkdir -p %t/MacOSX15.1.sdk/usr/include
+
+// RUN: %clang -xc %s -target arm64-apple-darwin13.0 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-C %s
+//
+// CHECK-C:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
+// CHECK-C:    #include <...> search starts here:
+// CHECK-C:    [[PATH]]/usr/include
+// CHECK-C:    [[PATH]]/System/Library/Frameworks (framework directory)
+// CHECK-C:    [[PATH]]/System/Library/SubFrameworks (framework directory)
+
+// RUN: %clang -xc++ %s -target arm64-apple-darwin13.0 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-CXX %s
+//
+// CHECK-CXX:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
+// CHECK-CXX:    #include <...> search starts here:
+// CHECK-CXX:    [[PATH]]/usr/include
+// CHECK-CXX:    [[PATH]]/System/Library/Frameworks (framework directory)
+// CHECK-CXX:    [[PATH]]/System/Library/SubFrameworks (framework directory)
diff --git a/clang/test/Driver/darwin-subframeworks.c 
b/clang/test/Driver/darwin-subframeworks.c
deleted file mode 100644
index 1a7a095c642922..00000000000000
--- a/clang/test/Driver/darwin-subframeworks.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// UNSUPPORTED: system-windows
-//   Windows is unsupported because we use the Unix path separator `\`.
-
-// Add default directories before running clang to check default 
-// search paths. 
-// RUN: rm -rf %t && mkdir -p %t
-// RUN: cp -R %S/Inputs/MacOSX15.1.sdk %t/
-// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/Frameworks
-// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/SubFrameworks
-// RUN: mkdir -p %t/MacOSX15.1.sdk/usr/include
-
-// RUN: %clang %s -target arm64-apple-darwin13.0 -isysroot %t/MacOSX15.1.sdk 
-E -v 2>&1 | FileCheck %s
-
-// CHECK:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
-// CHECK:    #include <...> search starts here:
-// CHECK:    [[PATH]]/usr/include
-// CHECK:    [[PATH]]/System/Library/Frameworks (framework directory)
-// CHECK:    [[PATH]]/System/Library/SubFrameworks (framework directory)
diff --git a/clang/test/Preprocessor/cuda-macos-includes.cu 
b/clang/test/Preprocessor/cuda-macos-includes.cu
index 6ef94b0e453520..dbc991dd610882 100644
--- a/clang/test/Preprocessor/cuda-macos-includes.cu
+++ b/clang/test/Preprocessor/cuda-macos-includes.cu
@@ -1,13 +1,6 @@
-// RUN: %clang -cc1 -fcuda-is-device -isysroot /var/empty \
-// RUN:   -triple nvptx-nvidia-cuda -aux-triple i386-apple-macosx \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
-// RUN: %clang -cc1 -isysroot /var/empty \
-// RUN:   -triple i386-apple-macosx -aux-triple nvptx-nvidia-cuda \
-// RUN:   -E -fcuda-is-device -v -o /dev/null -x cuda %s 2>&1 | FileCheck %s
-
 // Check that when we do CUDA host and device compiles on MacOS, we check for
 // includes in /System/Library/Frameworks and /Library/Frameworks.
 
-// CHECK-DAG: ignoring nonexistent directory 
"/var/empty/System/Library/Frameworks"
-// CHECK-DAG: ignoring nonexistent directory "/var/empty/Library/Frameworks"
+// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s
+// CHECK-DAG: "-internal-iframework" "/var/empty/System/Library/Frameworks"
+// CHECK-DAG: "-internal-iframework" "/var/empty/Library/Frameworks"

>From 561eb319e58d93a2e653267ba7a2347aeb71d77c Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Thu, 19 Dec 2024 12:16:56 -0500
Subject: [PATCH 2/6] Remove CUDA on Mac test since that isn't supported
 anymore

---
 clang/test/Preprocessor/cuda-macos-includes.cu | 6 ------
 1 file changed, 6 deletions(-)
 delete mode 100644 clang/test/Preprocessor/cuda-macos-includes.cu

diff --git a/clang/test/Preprocessor/cuda-macos-includes.cu 
b/clang/test/Preprocessor/cuda-macos-includes.cu
deleted file mode 100644
index dbc991dd610882..00000000000000
--- a/clang/test/Preprocessor/cuda-macos-includes.cu
+++ /dev/null
@@ -1,6 +0,0 @@
-// Check that when we do CUDA host and device compiles on MacOS, we check for
-// includes in /System/Library/Frameworks and /Library/Frameworks.
-
-// RUN: %clang -isysroot /var/empty -target unknown-nvidia-cuda -v 
-fsyntax-only -x cuda %s -### 2>&1 | FileCheck %s
-// CHECK-DAG: "-internal-iframework" "/var/empty/System/Library/Frameworks"
-// CHECK-DAG: "-internal-iframework" "/var/empty/Library/Frameworks"

>From 330d2e012ab5964683d52105182cffa50dcb1a08 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Thu, 19 Dec 2024 12:21:02 -0500
Subject: [PATCH 3/6] Use macosx15.1 target instead of darwin13.0

---
 clang/test/Driver/darwin-framework-search-paths.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/Driver/darwin-framework-search-paths.c 
b/clang/test/Driver/darwin-framework-search-paths.c
index 4bfe269f8d903d..c65f7fd3266921 100644
--- a/clang/test/Driver/darwin-framework-search-paths.c
+++ b/clang/test/Driver/darwin-framework-search-paths.c
@@ -9,7 +9,7 @@
 // RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/SubFrameworks
 // RUN: mkdir -p %t/MacOSX15.1.sdk/usr/include
 
-// RUN: %clang -xc %s -target arm64-apple-darwin13.0 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-C %s
+// RUN: %clang -xc %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-C %s
 //
 // CHECK-C:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
 // CHECK-C:    #include <...> search starts here:
@@ -17,7 +17,7 @@
 // CHECK-C:    [[PATH]]/System/Library/Frameworks (framework directory)
 // CHECK-C:    [[PATH]]/System/Library/SubFrameworks (framework directory)
 
-// RUN: %clang -xc++ %s -target arm64-apple-darwin13.0 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-CXX %s
+// RUN: %clang -xc++ %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-CXX %s
 //
 // CHECK-CXX:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
 // CHECK-CXX:    #include <...> search starts here:

>From 7cd2067c61500561d0736350384562db12952bf1 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Tue, 7 Jan 2025 10:18:18 -0500
Subject: [PATCH 4/6] Add SubFrameworks to Driverkit path test

---
 .../System/DriverKit/System/Library/SubFrameworks/.keep         | 0
 clang/test/Driver/driverkit-path.c                              | 2 ++
 2 files changed, 2 insertions(+)
 create mode 100644 
clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/SubFrameworks/.keep

diff --git 
a/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/SubFrameworks/.keep
 
b/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/SubFrameworks/.keep
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/clang/test/Driver/driverkit-path.c 
b/clang/test/Driver/driverkit-path.c
index 3caae382d65bb3..79fb439bc889b4 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -21,6 +21,7 @@ int main() { return 0; }
 // LD64-NEW: "-isysroot" "[[PATH:[^"]*]]Inputs/DriverKit19.0.sdk"
 // LD64-NEW-NOT: "-L[[PATH]]Inputs/DriverKit19.0.sdk/System/DriverKit/usr/lib"
 // LD64-NEW-NOT: 
"-F[[PATH]]Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/Frameworks"
+// LD64-NEW-NOT: 
"-F[[PATH]]Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/SubFrameworks"
 
 
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -isysroot 
%S/Inputs/DriverKit19.0.sdk -E -v -x c++ 2>&1 | FileCheck %s --check-prefix=INC
@@ -31,3 +32,4 @@ int main() { return 0; }
 // INC:       /lib{{(64)?}}/clang/{{[^/ ]+}}/include
 // INC:       [[PATH]]/System/DriverKit/usr/include
 // INC:       [[PATH]]/System/DriverKit/System/Library/Frameworks (framework 
directory)
+// INC:       [[PATH]]/System/DriverKit/System/Library/SubFrameworks 
(framework directory)

>From 41874535621dd5b2dd85cedd5edeed586a32a45d Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Tue, 7 Jan 2025 11:05:18 -0500
Subject: [PATCH 5/6] Make AddFrameworkInclude take same args as AddSearchPath

---
 clang/lib/Driver/ToolChains/Darwin.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index 19fd4dc148da73..9cfe037ec9a120 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2560,16 +2560,15 @@ void DarwinClang::AddClangSystemIncludeArgs(const 
llvm::opt::ArgList &DriverArgs
   }
 
   // Add default framework search paths
-  auto addFrameworkInclude = [&](auto ...Path) {
+  auto AddFrameworkInclude = [&](StringRef Flag, StringRef SearchPath) {
     SmallString<128> P(Sysroot);
-    llvm::sys::path::append(P, Path...);
-
-    CC1Args.push_back("-internal-iframework");
+    llvm::sys::path::append(P, SearchPath);
+    CC1Args.push_back(DriverArgs.MakeArgString(Flag));
     CC1Args.push_back(DriverArgs.MakeArgString(P));
   };
-  addFrameworkInclude("System", "Library", "Frameworks");
-  addFrameworkInclude("System", "Library", "SubFrameworks");
-  addFrameworkInclude("Library", "Frameworks");
+  AddFrameworkInclude("-internal-iframework", "/System/Library/Frameworks");
+  AddFrameworkInclude("-internal-iframework", "/System/Library/SubFrameworks");
+  AddFrameworkInclude("-internal-iframework", "/Library/Frameworks");
 }
 
 bool DarwinClang::AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList 
&DriverArgs,

>From 2f01df2ecab95523d7c35d98c548209106ff6d30 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionn...@gmail.com>
Date: Tue, 7 Jan 2025 11:26:51 -0500
Subject: [PATCH 6/6] Use -### style tests

---
 .../Driver/darwin-framework-search-paths.c    | 24 +++++++++----------
 clang/test/Driver/driverkit-path.c            | 16 ++++++-------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/clang/test/Driver/darwin-framework-search-paths.c 
b/clang/test/Driver/darwin-framework-search-paths.c
index c65f7fd3266921..651162c72d121b 100644
--- a/clang/test/Driver/darwin-framework-search-paths.c
+++ b/clang/test/Driver/darwin-framework-search-paths.c
@@ -9,18 +9,18 @@
 // RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/SubFrameworks
 // RUN: mkdir -p %t/MacOSX15.1.sdk/usr/include
 
-// RUN: %clang -xc %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-C %s
+// RUN: %clang -xc %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -c -### 2>&1 \
+// RUN: | FileCheck -DSDKROOT=%t/MacOSX15.1.sdk --check-prefix=CHECK-C %s
 //
-// CHECK-C:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
-// CHECK-C:    #include <...> search starts here:
-// CHECK-C:    [[PATH]]/usr/include
-// CHECK-C:    [[PATH]]/System/Library/Frameworks (framework directory)
-// CHECK-C:    [[PATH]]/System/Library/SubFrameworks (framework directory)
+// CHECK-C:    "-isysroot" "[[SDKROOT]]"
+// CHECK-C:    "-internal-externc-isystem" "[[SDKROOT]]/usr/include"
+// CHECK-C:    "-internal-iframework" "[[SDKROOT]]/System/Library/Frameworks"
+// CHECK-C:    "-internal-iframework" 
"[[SDKROOT]]/System/Library/SubFrameworks"
 
-// RUN: %clang -xc++ %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck --check-prefix=CHECK-CXX %s
+// RUN: %clang -xc++ %s -target arm64-apple-macosx15.1 -isysroot 
%t/MacOSX15.1.sdk -c -### 2>&1 \
+// RUN: | FileCheck -DSDKROOT=%t/MacOSX15.1.sdk --check-prefix=CHECK-CXX %s
 //
-// CHECK-CXX:    -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
-// CHECK-CXX:    #include <...> search starts here:
-// CHECK-CXX:    [[PATH]]/usr/include
-// CHECK-CXX:    [[PATH]]/System/Library/Frameworks (framework directory)
-// CHECK-CXX:    [[PATH]]/System/Library/SubFrameworks (framework directory)
+// CHECK-CXX:    "-isysroot" "[[SDKROOT]]"
+// CHECK-CXX:    "-internal-externc-isystem" "[[SDKROOT]]/usr/include"
+// CHECK-CXX:    "-internal-iframework" "[[SDKROOT]]/System/Library/Frameworks"
+// CHECK-CXX:    "-internal-iframework" 
"[[SDKROOT]]/System/Library/SubFrameworks"
diff --git a/clang/test/Driver/driverkit-path.c 
b/clang/test/Driver/driverkit-path.c
index 79fb439bc889b4..900e2f06eb4ce8 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -24,12 +24,12 @@ int main() { return 0; }
 // LD64-NEW-NOT: 
"-F[[PATH]]Inputs/DriverKit19.0.sdk/System/DriverKit/System/Library/SubFrameworks"
 
 
-// RUN: %clang %s -target x86_64-apple-driverkit19.0 -isysroot 
%S/Inputs/DriverKit19.0.sdk -E -v -x c++ 2>&1 | FileCheck %s --check-prefix=INC
+// RUN: %clang %s -target x86_64-apple-driverkit19.0 -isysroot 
%S/Inputs/DriverKit19.0.sdk -x c++ -### 2>&1 \
+// RUN: | FileCheck %s -DSDKROOT=%S/Inputs/DriverKit19.0.sdk --check-prefix=INC
 //
-// INC:       -isysroot [[PATH:[^ ]*/Inputs/DriverKit19.0.sdk]]
-// INC-LABEL: #include <...> search starts here:
-// INC:       [[PATH]]/System/DriverKit/usr/local/include
-// INC:       /lib{{(64)?}}/clang/{{[^/ ]+}}/include
-// INC:       [[PATH]]/System/DriverKit/usr/include
-// INC:       [[PATH]]/System/DriverKit/System/Library/Frameworks (framework 
directory)
-// INC:       [[PATH]]/System/DriverKit/System/Library/SubFrameworks 
(framework directory)
+// INC:       "-isysroot" "[[SDKROOT]]"
+// INC:       "-internal-isystem" 
"[[SDKROOT]]/System/DriverKit/usr/local/include"
+// INC:       "-internal-isystem" "{{.+}}/lib{{(64)?}}/clang/{{[^/ 
]+}}/include"
+// INC:       "-internal-externc-isystem" 
"[[SDKROOT]]/System/DriverKit/usr/include"
+// INC:       "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/Frameworks"
+// INC:       "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/SubFrameworks"

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to