]> granicus.if.org Git - clang/commitdiff
Disable SjLj exceptions for watchOS
authorTim Northover <tnorthover@apple.com>
Fri, 30 Oct 2015 16:30:41 +0000 (16:30 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 30 Oct 2015 16:30:41 +0000 (16:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251709 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/ToolChain.h
lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h
lib/Driver/Tools.cpp
test/Driver/arch-armv7k.c

index edbf56200f3c8966eba13af2e5b09f71eeb60df2..58e7c724cd037ffd87989fd2fe2d3775497e5b38 100644 (file)
@@ -304,7 +304,9 @@ public:
   virtual bool GetDefaultStandaloneDebug() const { return false; }
 
   /// UseSjLjExceptions - Does this tool chain use SjLj exceptions.
-  virtual bool UseSjLjExceptions() const { return false; }
+  virtual bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const {
+    return false;
+  }
 
   /// getThreadModel() - Which thread model does this target use?
   virtual std::string getThreadModel() const { return "posix"; }
index b65c5c136084c64935e415e4b4e32e485522dda0..43a8ff657dd7784590d7fc95ee78ffa33110ed5f 100644 (file)
@@ -1037,10 +1037,18 @@ bool MachO::UseDwarfDebugFlags() const {
   return false;
 }
 
-bool Darwin::UseSjLjExceptions() const {
+bool Darwin::UseSjLjExceptions(const ArgList &Args) const {
   // Darwin uses SjLj exceptions on ARM.
-  return (getTriple().getArch() == llvm::Triple::arm ||
-          getTriple().getArch() == llvm::Triple::thumb);
+  if (getTriple().getArch() != llvm::Triple::arm &&
+      getTriple().getArch() != llvm::Triple::thumb)
+    return false;
+
+  // We can't check directly for watchOS here. ComputeLLVMTriple only
+  // fills in the ArchName correctly.
+  llvm::Triple Triple(ComputeLLVMTriple(Args));
+  return !(Triple.getArchName() == "armv7k" ||
+           Triple.getArchName() == "thumbv7k");
+
 }
 
 bool MachO::isPICDefault() const { return true; }
@@ -2952,7 +2960,7 @@ Tool *FreeBSD::buildAssembler() const {
 
 Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
 
-bool FreeBSD::UseSjLjExceptions() const {
+bool FreeBSD::UseSjLjExceptions(const ArgList &Args) const {
   // FreeBSD uses SjLj exceptions on ARM oabi.
   switch (getTriple().getEnvironment()) {
   case llvm::Triple::GNUEABIHF:
index d88403239fbd73e4fc6f0594ca88d426b3370bb2..77433789f95da5fce3d1ee6429c82af7f2f0f68f 100644 (file)
@@ -339,7 +339,9 @@ public:
 
   bool UseDwarfDebugFlags() const override;
 
-  bool UseSjLjExceptions() const override { return false; }
+  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override {
+    return false;
+  }
 
   /// }
 };
@@ -528,7 +530,7 @@ public:
 
   void CheckObjCARC() const override;
 
-  bool UseSjLjExceptions() const override;
+  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
 };
@@ -714,7 +716,7 @@ public:
       const llvm::opt::ArgList &DriverArgs,
       llvm::opt::ArgStringList &CC1Args) const override;
 
-  bool UseSjLjExceptions() const override;
+  bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
   bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   unsigned GetDefaultDwarfVersion() const override { return 2; }
index 42a168584cd676d10505c60e706da9aa794f4157..e72e4bdcb2262d9f9974415b366361cab3ce23cc 100644 (file)
@@ -4824,7 +4824,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, objcRuntime,
                      CmdArgs);
 
-  if (getToolChain().UseSjLjExceptions())
+  if (getToolChain().UseSjLjExceptions(Args))
     CmdArgs.push_back("-fsjlj-exceptions");
 
   // C++ "sane" operator new.
index 7f5923e7ddb1ef02acba61ecaa4807f30d30f799..190d8999ab6ebbfa1affb72603210e25b2f7255e 100644 (file)
@@ -2,3 +2,4 @@
 
 // RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -c %s -### 2>&1 | FileCheck %s
 // CHECK: "-cc1"{{.*}} "-target-cpu" "cortex-a7"
+// CHECK-NOT: "-fsjlj-exceptions"