r253355 - ARM: fix mismatch between Clang and backend on exception type.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 17 10:27:27 PST 2015


Author: tnorthover
Date: Tue Nov 17 12:27:27 2015
New Revision: 253355

URL: http://llvm.org/viewvc/llvm-project?rev=253355&view=rev
Log:
ARM: fix mismatch between Clang and backend on exception type.

"-arch armv7k" is only normally used with a watchos target, but Clang doesn't
stop you from giving a "-miphoneos-version-min" option too, converting the
triple to "thumbv7k-apple-ios". In this case the backend will decide to use
SjLj exceptions, so Clang needs to agree so it can create the correct
predefines.

Fortunately, there's a handy function to make the decision for us now.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/arch-armv7k.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253355&r1=253354&r2=253355&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Nov 17 12:27:27 2015
@@ -1053,12 +1053,8 @@ bool Darwin::UseSjLjExceptions(const Arg
       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");
-
+  // Only watchOS uses the new DWARF/Compact unwinding method.
+  return !isTargetWatchOS();
 }
 
 bool MachO::isPICDefault() const { return true; }

Modified: cfe/trunk/test/Driver/arch-armv7k.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arch-armv7k.c?rev=253355&r1=253354&r2=253355&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arch-armv7k.c (original)
+++ cfe/trunk/test/Driver/arch-armv7k.c Tue Nov 17 12:27:27 2015
@@ -1,5 +1,13 @@
-// Tests that make sure armv7k is mapped to the correct CPU
+// Tests that make sure armv7k is mapped to the correct CPU and ABI choices
 
 // 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"
+
+// "thumbv7k-apple-ios" is a bit of a weird triple, but since the backend is
+// going to choose to use sjlj-based exceptions for it, the front-end needs to
+// match.
+
+// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -miphoneos-version-min=9.0 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SJLJ
+// CHECK-SJLJ: "-cc1"{{.*}} "-target-cpu" "cortex-a7"
+// CHECK-SJLJ: "-fsjlj-exceptions"




More information about the cfe-commits mailing list