Author: tnorthover Date: Fri Oct 30 11:30:41 2015 New Revision: 251709 URL: http://llvm.org/viewvc/llvm-project?rev=251709&view=rev Log: Disable SjLj exceptions for watchOS
Modified: cfe/trunk/include/clang/Driver/ToolChain.h cfe/trunk/lib/Driver/ToolChains.cpp cfe/trunk/lib/Driver/ToolChains.h cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/arch-armv7k.c Modified: cfe/trunk/include/clang/Driver/ToolChain.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=251709&r1=251708&r2=251709&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/ToolChain.h (original) +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 30 11:30:41 2015 @@ -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"; } Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251709&r1=251708&r2=251709&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct 30 11:30:41 2015 @@ -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: Modified: cfe/trunk/lib/Driver/ToolChains.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=251709&r1=251708&r2=251709&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.h (original) +++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct 30 11:30:41 2015 @@ -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; } Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251709&r1=251708&r2=251709&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 30 11:30:41 2015 @@ -4824,7 +4824,7 @@ void Clang::ConstructJob(Compilation &C, addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, objcRuntime, CmdArgs); - if (getToolChain().UseSjLjExceptions()) + if (getToolChain().UseSjLjExceptions(Args)) CmdArgs.push_back("-fsjlj-exceptions"); // C++ "sane" operator new. Modified: cfe/trunk/test/Driver/arch-armv7k.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arch-armv7k.c?rev=251709&r1=251708&r2=251709&view=diff ============================================================================== --- cfe/trunk/test/Driver/arch-armv7k.c (original) +++ cfe/trunk/test/Driver/arch-armv7k.c Fri Oct 30 11:30:41 2015 @@ -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" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits