Author: Nico Weber
Date: 2025-01-07T09:23:50-05:00
New Revision: ab5133bbc62af4686f305a3c7d85f74b9f5b949f

URL: 
https://github.com/llvm/llvm-project/commit/ab5133bbc62af4686f305a3c7d85f74b9f5b949f
DIFF: 
https://github.com/llvm/llvm-project/commit/ab5133bbc62af4686f305a3c7d85f74b9f5b949f.diff

LOG: Revert "[Darwin][Driver][clang] apple-none-macho orders the resource 
directory after internal-externc-isystem when nostdlibinc is used (#120507)"

This reverts commit 653a54727eaa18c43447ad686c987db67f1dda74.
Breaks tests, see 
https://github.com/llvm/llvm-project/pull/120507#issuecomment-2575246281

Added: 
    

Modified: 
    clang/lib/Basic/Targets/OSTargets.cpp
    clang/lib/Driver/Driver.cpp
    clang/lib/Driver/ToolChains/Darwin.cpp
    clang/lib/Driver/ToolChains/Darwin.h
    clang/lib/Frontend/InitPreprocessor.cpp
    clang/lib/Lex/InitHeaderSearch.cpp
    clang/test/Preprocessor/macho-embedded-predefines.c
    llvm/include/llvm/TargetParser/Triple.h

Removed: 
    clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep
    clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep
    clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep
    clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep
    clang/test/Driver/darwin-embedded-search-paths.c


################################################################################
diff  --git a/clang/lib/Basic/Targets/OSTargets.cpp 
b/clang/lib/Basic/Targets/OSTargets.cpp
index 6f98353fb8c2e4..88c054150ab224 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -114,6 +114,9 @@ void getDarwinDefines(MacroBuilder &Builder, const 
LangOptions &Opts,
     assert(OsVersion.getMinor().value_or(0) < 100 &&
            OsVersion.getSubminor().value_or(0) < 100 && "Invalid version!");
     Builder.defineMacro("__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__", Str);
+
+    // Tell users about the kernel if there is one.
+    Builder.defineMacro("__MACH__");
   }
 
   PlatformMinVersion = OsVersion;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 7a678ea8aa3fad..36d6c93c43321f 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6686,8 +6686,6 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
           TC = std::make_unique<toolchains::BareMetal>(*this, Target, Args);
         else if (Target.isOSBinFormatELF())
           TC = std::make_unique<toolchains::Generic_ELF>(*this, Target, Args);
-        else if (Target.isAppleMachO())
-          TC = std::make_unique<toolchains::AppleMachO>(*this, Target, Args);
         else if (Target.isOSBinFormatMachO())
           TC = std::make_unique<toolchains::MachO>(*this, Target, Args);
         else

diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index e5dffb11d1a5e6..56b6dd78673cb6 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -966,14 +966,11 @@ MachO::MachO(const Driver &D, const llvm::Triple &Triple, 
const ArgList &Args)
   getProgramPaths().push_back(getDriver().Dir);
 }
 
-AppleMachO::AppleMachO(const Driver &D, const llvm::Triple &Triple,
-                       const ArgList &Args)
-    : MachO(D, Triple, Args), CudaInstallation(D, Triple, Args),
-      RocmInstallation(D, Triple, Args), SYCLInstallation(D, Triple, Args) {}
-
 /// Darwin - Darwin tool chain for i386 and x86_64.
 Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList 
&Args)
-    : AppleMachO(D, Triple, Args), TargetInitialized(false) {}
+    : MachO(D, Triple, Args), TargetInitialized(false),
+      CudaInstallation(D, Triple, Args), RocmInstallation(D, Triple, Args),
+      SYCLInstallation(D, Triple, Args) {}
 
 types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
   types::ID Ty = ToolChain::LookupTypeForExtension(Ext);
@@ -1022,18 +1019,18 @@ bool Darwin::hasBlocksRuntime() const {
   }
 }
 
-void AppleMachO::AddCudaIncludeArgs(const ArgList &DriverArgs,
-                                    ArgStringList &CC1Args) const {
+void Darwin::AddCudaIncludeArgs(const ArgList &DriverArgs,
+                                ArgStringList &CC1Args) const {
   CudaInstallation->AddCudaIncludeArgs(DriverArgs, CC1Args);
 }
 
-void AppleMachO::AddHIPIncludeArgs(const ArgList &DriverArgs,
-                                   ArgStringList &CC1Args) const {
+void Darwin::AddHIPIncludeArgs(const ArgList &DriverArgs,
+                               ArgStringList &CC1Args) const {
   RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
 }
 
-void AppleMachO::addSYCLIncludeArgs(const ArgList &DriverArgs,
-                                    ArgStringList &CC1Args) const {
+void Darwin::addSYCLIncludeArgs(const ArgList &DriverArgs,
+                                ArgStringList &CC1Args) const {
   SYCLInstallation->addSYCLIncludeArgs(DriverArgs, CC1Args);
 }
 
@@ -1128,8 +1125,6 @@ VersionTuple MachO::getLinkerVersion(const 
llvm::opt::ArgList &Args) const {
 
 Darwin::~Darwin() {}
 
-AppleMachO::~AppleMachO() {}
-
 MachO::~MachO() {}
 
 std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args,
@@ -2493,7 +2488,7 @@ static void AppendPlatformPrefix(SmallString<128> &Path,
 // Returns the effective sysroot from either -isysroot or --sysroot, plus the
 // platform prefix (if any).
 llvm::SmallString<128>
-AppleMachO::GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const {
+DarwinClang::GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const {
   llvm::SmallString<128> Path("/");
   if (DriverArgs.hasArg(options::OPT_isysroot))
     Path = DriverArgs.getLastArgValue(options::OPT_isysroot);
@@ -2506,9 +2501,8 @@ AppleMachO::GetEffectiveSysroot(const llvm::opt::ArgList 
&DriverArgs) const {
   return Path;
 }
 
-void AppleMachO::AddClangSystemIncludeArgs(
-    const llvm::opt::ArgList &DriverArgs,
-    llvm::opt::ArgStringList &CC1Args) const {
+void DarwinClang::AddClangSystemIncludeArgs(const llvm::opt::ArgList 
&DriverArgs,
+                                            llvm::opt::ArgStringList &CC1Args) 
const {
   const Driver &D = getDriver();
 
   llvm::SmallString<128> Sysroot = GetEffectiveSysroot(DriverArgs);
@@ -2586,7 +2580,7 @@ bool DarwinClang::AddGnuCPlusPlusIncludePaths(const 
llvm::opt::ArgList &DriverAr
   return getVFS().exists(Base);
 }
 
-void AppleMachO::AddClangCXXStdlibIncludeArgs(
+void DarwinClang::AddClangCXXStdlibIncludeArgs(
     const llvm::opt::ArgList &DriverArgs,
     llvm::opt::ArgStringList &CC1Args) const {
   // The implementation from a base class will pass through the -stdlib to
@@ -2643,60 +2637,55 @@ void AppleMachO::AddClangCXXStdlibIncludeArgs(
   }
 
   case ToolChain::CST_Libstdcxx:
-    AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args);
-    break;
-  }
-}
-
-void AppleMachO::AddGnuCPlusPlusIncludePaths(
-    const llvm::opt::ArgList &DriverArgs,
-    llvm::opt::ArgStringList &CC1Args) const {}
-
-void DarwinClang::AddGnuCPlusPlusIncludePaths(
-    const llvm::opt::ArgList &DriverArgs,
-    llvm::opt::ArgStringList &CC1Args) const {
-  llvm::SmallString<128> UsrIncludeCxx = GetEffectiveSysroot(DriverArgs);
-  llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
+    llvm::SmallString<128> UsrIncludeCxx = Sysroot;
+    llvm::sys::path::append(UsrIncludeCxx, "usr", "include", "c++");
+
+    llvm::Triple::ArchType arch = getTriple().getArch();
+    bool IsBaseFound = true;
+    switch (arch) {
+    default: break;
+
+    case llvm::Triple::x86:
+    case llvm::Triple::x86_64:
+      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, 
UsrIncludeCxx,
+                                                "4.2.1",
+                                                "i686-apple-darwin10",
+                                                arch == llvm::Triple::x86_64 ? 
"x86_64" : "");
+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, 
UsrIncludeCxx,
+                                                "4.0.0", "i686-apple-darwin8",
+                                                 "");
+      break;
 
-  llvm::Triple::ArchType arch = getTriple().getArch();
-  bool IsBaseFound = true;
-  switch (arch) {
-  default:
-    break;
+    case llvm::Triple::arm:
+    case llvm::Triple::thumb:
+      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, 
UsrIncludeCxx,
+                                                "4.2.1",
+                                                "arm-apple-darwin10",
+                                                "v7");
+      IsBaseFound |= AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, 
UsrIncludeCxx,
+                                                "4.2.1",
+                                                "arm-apple-darwin10",
+                                                 "v6");
+      break;
 
-  case llvm::Triple::x86:
-  case llvm::Triple::x86_64:
-    IsBaseFound = AddGnuCPlusPlusIncludePaths(
-        DriverArgs, CC1Args, UsrIncludeCxx, "4.2.1", "i686-apple-darwin10",
-        arch == llvm::Triple::x86_64 ? "x86_64" : "");
-    IsBaseFound |= AddGnuCPlusPlusIncludePaths(
-        DriverArgs, CC1Args, UsrIncludeCxx, "4.0.0", "i686-apple-darwin8", "");
-    break;
+    case llvm::Triple::aarch64:
+      IsBaseFound = AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, 
UsrIncludeCxx,
+                                                "4.2.1",
+                                                "arm64-apple-darwin10",
+                                                "");
+      break;
+    }
 
-  case llvm::Triple::arm:
-  case llvm::Triple::thumb:
-    IsBaseFound =
-        AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx, 
"4.2.1",
-                                    "arm-apple-darwin10", "v7");
-    IsBaseFound |=
-        AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx, 
"4.2.1",
-                                    "arm-apple-darwin10", "v6");
-    break;
+    if (!IsBaseFound) {
+      getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
+    }
 
-  case llvm::Triple::aarch64:
-    IsBaseFound =
-        AddGnuCPlusPlusIncludePaths(DriverArgs, CC1Args, UsrIncludeCxx, 
"4.2.1",
-                                    "arm64-apple-darwin10", "");
     break;
   }
-
-  if (!IsBaseFound) {
-    getDriver().Diag(diag::warn_drv_libstdcxx_not_found);
-  }
 }
 
-void AppleMachO::AddCXXStdlibLibArgs(const ArgList &Args,
-                                     ArgStringList &CmdArgs) const {
+void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
+                                      ArgStringList &CmdArgs) const {
   CXXStdlibType Type = GetCXXStdlibType(Args);
 
   switch (Type) {
@@ -3632,7 +3621,7 @@ SanitizerMask Darwin::getSupportedSanitizers() const {
   return Res;
 }
 
-void AppleMachO::printVerboseInfo(raw_ostream &OS) const {
+void Darwin::printVerboseInfo(raw_ostream &OS) const {
   CudaInstallation->print(OS);
   RocmInstallation->print(OS);
 }

diff  --git a/clang/lib/Driver/ToolChains/Darwin.h 
b/clang/lib/Driver/ToolChains/Darwin.h
index c44780c577f4f4..5bc18581cfd2e8 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -291,52 +291,8 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
   /// }
 };
 
-/// Apple specific MachO extensions
-class LLVM_LIBRARY_VISIBILITY AppleMachO : public MachO {
-public:
-  AppleMachO(const Driver &D, const llvm::Triple &Triple,
-             const llvm::opt::ArgList &Args);
-  ~AppleMachO() override;
-
-  /// }
-  /// @name Apple Specific ToolChain Implementation
-  /// {
-  void
-  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
-                            llvm::opt::ArgStringList &CC1Args) const override;
-
-  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
-                          llvm::opt::ArgStringList &CC1Args) const override;
-  void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
-                         llvm::opt::ArgStringList &CC1Args) const override;
-  void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
-                          llvm::opt::ArgStringList &CC1Args) const override;
-
-  void AddClangCXXStdlibIncludeArgs(
-      const llvm::opt::ArgList &DriverArgs,
-      llvm::opt::ArgStringList &CC1Args) const override;
-  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
-                           llvm::opt::ArgStringList &CmdArgs) const override;
-
-  void printVerboseInfo(raw_ostream &OS) const override;
-  /// }
-
-  LazyDetector<CudaInstallationDetector> CudaInstallation;
-  LazyDetector<RocmInstallationDetector> RocmInstallation;
-  LazyDetector<SYCLInstallationDetector> SYCLInstallation;
-
-protected:
-  llvm::SmallString<128>
-  GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const;
-
-private:
-  virtual void
-  AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
-                              llvm::opt::ArgStringList &CC1Args) const;
-};
-
 /// Darwin - The base Darwin tool chain.
-class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
+class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
 public:
   /// Whether the information on the target has been initialized.
   //
@@ -374,6 +330,10 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
   /// The target variant triple that was specified (if any).
   mutable std::optional<llvm::Triple> TargetVariantTriple;
 
+  LazyDetector<CudaInstallationDetector> CudaInstallation;
+  LazyDetector<RocmInstallationDetector> RocmInstallation;
+  LazyDetector<SYCLInstallationDetector> SYCLInstallation;
+
 private:
   void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
 
@@ -385,7 +345,7 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
   std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
                                           types::ID InputType) const override;
 
-  /// @name Darwin Specific Toolchain Implementation
+  /// @name Apple Specific Toolchain Implementation
   /// {
 
   void addMinVersionArgs(const llvm::opt::ArgList &Args,
@@ -601,6 +561,13 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
   ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
   bool hasBlocksRuntime() const override;
 
+  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+                          llvm::opt::ArgStringList &CC1Args) const override;
+  void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+                         llvm::opt::ArgStringList &CC1Args) const override;
+  void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+                          llvm::opt::ArgStringList &CC1Args) const override;
+
   bool UseObjCMixedDispatch() const override {
     // This is only used with the non-fragile ABI and non-legacy dispatch.
 
@@ -631,6 +598,8 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public AppleMachO {
   bool SupportsEmbeddedBitcode() const override;
 
   SanitizerMask getSupportedSanitizers() const override;
+
+  void printVerboseInfo(raw_ostream &OS) const override;
 };
 
 /// DarwinClang - The Darwin toolchain used by Clang.
@@ -648,6 +617,16 @@ class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
                              llvm::opt::ArgStringList &CmdArgs,
                              bool ForceLinkBuiltinRT = false) const override;
 
+  void AddClangCXXStdlibIncludeArgs(
+      const llvm::opt::ArgList &DriverArgs,
+      llvm::opt::ArgStringList &CC1Args) const override;
+
+  void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+                                 llvm::opt::ArgStringList &CC1Args) const 
override;
+
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+                           llvm::opt::ArgStringList &CmdArgs) const override;
+
   void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
                         llvm::opt::ArgStringList &CmdArgs) const override;
 
@@ -672,16 +651,15 @@ class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin 
{
                                StringRef Sanitizer,
                                bool shared = true) const;
 
-  void
-  AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
-                              llvm::opt::ArgStringList &CC1Args) const 
override;
-
   bool AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
                                    llvm::opt::ArgStringList &CC1Args,
                                    llvm::SmallString<128> Base,
                                    llvm::StringRef Version,
                                    llvm::StringRef ArchDir,
                                    llvm::StringRef BitDir) const;
+
+  llvm::SmallString<128>
+  GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const;
 };
 
 } // end namespace toolchains

diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 8eba766f21a640..29723b573e771a 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1507,11 +1507,6 @@ static void InitializePredefinedMacros(const TargetInfo 
&TI,
   // ELF targets define __ELF__
   if (TI.getTriple().isOSBinFormatELF())
     Builder.defineMacro("__ELF__");
-  else if (TI.getTriple().isAppleMachO())
-    // Apple MachO targets define __MACH__ even when not using 
DarwinTargetInfo.
-    // Hurd will also define this in some circumstances, but that's done in
-    // HurdTargetInfo. Windows targets don't define this.
-    Builder.defineMacro("__MACH__");
 
   // Target OS macro definitions.
   if (PPOpts.DefineTargetOSMacros) {

diff  --git a/clang/lib/Lex/InitHeaderSearch.cpp 
b/clang/lib/Lex/InitHeaderSearch.cpp
index bb2a21356fa8fe..67c9d92b849ea3 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -313,7 +313,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
     break;
 
   case llvm::Triple::UnknownOS:
-    if (triple.isWasm() || triple.isAppleMachO())
+    if (triple.isWasm())
       return false;
     break;
 

diff  --git 
a/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep 
b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep
deleted file mode 100644
index e69de29bb2d1d6..00000000000000

diff  --git 
a/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep 
b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep
deleted file mode 100644
index e69de29bb2d1d6..00000000000000

diff  --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep 
b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep
deleted file mode 100644
index e69de29bb2d1d6..00000000000000

diff  --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep 
b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep
deleted file mode 100644
index e69de29bb2d1d6..00000000000000

diff  --git a/clang/test/Driver/darwin-embedded-search-paths.c 
b/clang/test/Driver/darwin-embedded-search-paths.c
deleted file mode 100644
index d8b0139ababa3d..00000000000000
--- a/clang/test/Driver/darwin-embedded-search-paths.c
+++ /dev/null
@@ -1,43 +0,0 @@
-// UNSUPPORTED: system-windows
-//   Windows is unsupported because we use the Unix path separator `/` in the 
test.
-
-// Unlike the Darwin driver, the MachO driver doesn't add any framework search 
paths,
-// only the normal header ones.
-// RUN: %clang -x c -target arm64-apple-none-macho -isysroot 
%S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW 
-DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s
-
-// Unlike the Darwin driver, the MachO driver doesn't default to libc++
-// RUN: %clang -x c++ -target arm64-apple-none-macho -isysroot 
%S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW 
-DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s
-
-// However, if the user requests libc++, the MachO driver should find the 
search path.
-// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot 
%S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \
-// RUN: | FileCheck --check-prefixes=CC1,CXX,ULI,CI,UI,NO-FW 
-DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s
-
-// Verify that embedded uses can swap in alternate usr/include and 
usr/local/include directories.
-// usr/local/include is specified in the driver as -internal-isystem, however, 
the driver generated
-// paths come before the paths in the driver arguments. In order to keep 
usr/local/include in the
-// same position, -isystem has to be used instead of -Xclang 
-internal-isystem. There isn't an
-// -externc-isystem, but it's ok to use -Xclang -internal-externc-isystem 
since the driver doesn't
-// use that if -nostdlibinc or -nostdinc is passed.
-// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot 
%S/Inputs/MacOSX15.1.sdk \
-// RUN:        -nostdlibinc -isystem 
%S/Inputs/MacOSX15.1.sdk/embedded/usr/local/include \
-// RUN:        -Xclang -internal-externc-isystem -Xclang 
%S/Inputs/MacOSX15.1.sdk/embedded/usr/include \
-// RUN:        -### -c %s 2>&1 | FileCheck 
--check-prefixes=CC1,NO-CXX,EULI,CI,EUI,NO-FW 
-DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s
-
-
-// The ordering of these flags doesn't matter, and so this test is a little
-// fragile. i.e. all of the -internal-isystem paths will be searched before the
-// -internal-externc-isystem ones, and their order on the command line doesn't
-// matter. The line order here is just the current order that the driver writes
-// the cc1 arguments.
-
-// CC1: "-cc1"
-// NO-CXX-NOT: "-internal-isystem" "[[SDKROOT]]/usr/include/c++/v1"
-// CXX-SAME: "-internal-isystem" "[[SDKROOT]]/usr/include/c++/v1"
-// ULI-SAME: "-internal-isystem" "[[SDKROOT]]/usr/local/include"
-// EULI-SAME: "-isystem" "[[SDKROOT]]/embedded/usr/local/include"
-// CI-SAME: "-internal-isystem" "{{.*}}/clang/{{[[:digit:].]*}}/include"
-// UI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/usr/include"
-// EUI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/embedded/usr/include"
-// NO-FW-NOT: "-internal-iframework"

diff  --git a/clang/test/Preprocessor/macho-embedded-predefines.c 
b/clang/test/Preprocessor/macho-embedded-predefines.c
index a7e5777a89a980..74f29199218c4b 100644
--- a/clang/test/Preprocessor/macho-embedded-predefines.c
+++ b/clang/test/Preprocessor/macho-embedded-predefines.c
@@ -3,18 +3,18 @@
 // CHECK-7M: #define __APPLE_CC__
 // CHECK-7M: #define __APPLE__
 // CHECK-7M: #define __ARM_ARCH_7M__
-// CHECK-7M: #define __MACH__
+// CHECK-7M-NOT: #define __MACH__
 
 // RUN: %clang_cc1 -E -dM -triple thumbv7em-apple-unknown-macho -target-cpu 
cortex-m4 %s | FileCheck %s -check-prefix CHECK-7EM
 
 // CHECK-7EM: #define __APPLE_CC__
 // CHECK-7EM: #define __APPLE__
 // CHECK-7EM: #define __ARM_ARCH_7EM__
-// CHECK-7EM: #define __MACH__
+// CHECK-7EM-NOT: #define __MACH__
 
 // RUN: %clang_cc1 -E -dM -triple thumbv6m-apple-unknown-macho -target-cpu 
cortex-m0 %s | FileCheck %s -check-prefix CHECK-6M
 
 // CHECK-6M: #define __APPLE_CC__
 // CHECK-6M: #define __APPLE__
 // CHECK-6M: #define __ARM_ARCH_6M__
-// CHECK-6M: #define __MACH__
+// CHECK-6M-NOT: #define __MACH__

diff  --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 76914ab34c1f67..844f11feef4141 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -564,11 +564,6 @@ class Triple {
 
   bool isOSzOS() const { return getOS() == Triple::ZOS; }
 
-  /// Is this an Apple MachO triple.
-  bool isAppleMachO() const {
-    return (getVendor() == Triple::Apple) && isOSBinFormatMachO();
-  }
-
   /// Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
   bool isOSDarwin() const {
     return isMacOSX() || isiOS() || isWatchOS() || isDriverKit() || isXROS();


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

Reply via email to