]> granicus.if.org Git - clang/commitdiff
Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exception...
authorAnders Carlsson <andersca@mac.com>
Tue, 22 Feb 2011 01:52:06 +0000 (01:52 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 22 Feb 2011 01:52:06 +0000 (01:52 +0000)
Update all tests accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126177 91177308-0d34-0410-b5e6-96231b3b80d8

32 files changed:
include/clang/Driver/CC1Options.td
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
test/CodeGenObjC/blocks-4.m
test/CodeGenObjC/exceptions-nonfragile.m
test/CodeGenObjC/exceptions.m
test/CodeGenObjC/gnu-exceptions.m
test/CodeGenObjC/metadata_symbols.m
test/CodeGenObjC/nested-rethrow.m
test/CodeGenObjC/rdr-6732143-dangling-block-reference.m
test/CodeGenObjC/try.m
test/CodeGenObjC/unwind-fn.m
test/Coverage/ast-printing.m
test/Coverage/codegen-gnu.m
test/Coverage/codegen-next.m
test/Driver/rewrite-objc.m
test/PCH/objc_stmts.m
test/Parser/objc-try-catch-1.m
test/Rewriter/finally.m
test/Rewriter/rewrite-eh.m
test/Rewriter/rewrite-try-catch.m
test/SemaObjC/catch-stmt.m
test/SemaObjC/invalid-code.m
test/SemaObjC/no-objc-exceptions.m
test/SemaObjC/property-6.m
test/SemaObjC/rdar6248119.m
test/SemaObjC/return.m
test/SemaObjC/scope-check.m
test/SemaObjC/stmts.m
test/SemaObjC/try-catch.m
test/SemaObjC/warn-unused-exception-param.m
test/SemaObjCXX/instantiate-stmt.mm

index 17fd41a40669658238739c2db74491185e3c26ac..8d56a4230ec5723e83a184e66a1cf6a253c8f529 100644 (file)
@@ -420,7 +420,7 @@ def fexceptions : Flag<"-fexceptions">,
   HelpText<"Enable support for exception handling">;
 def fsjlj_exceptions : Flag<"-fsjlj-exceptions">,
   HelpText<"Use SjLj style exceptions">;
-def fno_objc_exceptions : Flag<"-fno-objc-exceptions">,
+def fobjc_exceptions : Flag<"-fobjc-exceptions">,
   HelpText<"Disable Objective-C exceptions">;
 def ffreestanding : Flag<"-ffreestanding">,
   HelpText<"Assert that the compilation takes place in a freestanding environment">;
index 2f264e5387742270b7766e3a51324ea422bf68e6..9f4a0bc162e3556bc607a277994a81ad22c9220a 100644 (file)
@@ -1546,10 +1546,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       CmdArgs.push_back("-fobjc-default-synthesize-properties");
     }
 
-    // -fobjc-exceptions is default.
-    if (!Args.hasFlag(options::OPT_fobjc_exceptions, 
-                      options::OPT_fno_objc_exceptions))
-      CmdArgs.push_back("-fno-objc-exceptions");
+    // -fno-objc-exceptions is default.
+    if (IsRewriter || Args.hasFlag(options::OPT_fobjc_exceptions, 
+                                   options::OPT_fno_objc_exceptions))
+      CmdArgs.push_back("-fobjc-exceptions");
   }
 
   if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
index 915634b1dd736ac031519b11a22a97dbbae05a7d..d510b5bc5241ef29a7468d2313eb64063f019038 100644 (file)
@@ -1460,7 +1460,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   if (Args.hasArg(OPT_fno_threadsafe_statics))
     Opts.ThreadsafeStatics = 0;
   Opts.Exceptions = Args.hasArg(OPT_fexceptions);
-  Opts.ObjCExceptions = !Args.hasArg(OPT_fno_objc_exceptions);
+  Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
   Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
   Opts.Blocks = Args.hasArg(OPT_fblocks);
   Opts.CharIsSigned = !Args.hasArg(OPT_fno_signed_char);
@@ -1490,7 +1490,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
   Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags);
   Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
-  Opts.ObjCExceptions = !Args.hasArg(OPT_fno_objc_exceptions);
+  Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
   Opts.Static = Args.hasArg(OPT_static_define);
   Opts.DumpRecordLayouts = Args.hasArg(OPT_fdump_record_layouts);
   Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
index d945ed44fac0750d11388b2049c4862dc11a2cc7..f2d6e21a1ce1fbf8ddf788bdf745ed1812c2c6fc 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions -fblocks -o %t %s
 // rdar://7590273
 
 void EXIT(id e);
index 57ed1d9da9dd2e53c0de6759cdd8cfde58e49454..280b5d416ffac98e74f49ac9cbc6b62f24a45af8 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -O2 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s
 
 // rdar://problem/8535238
 // CHECK: declare void @objc_exception_rethrow()
index 31805cb8df4e184a8c7dd09891ad9860d19b6d25..d378f848f861c5b593d26a14fe09eb01aeddd300 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -O2 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s
 //
 // <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
 
index 6790a2993750114d8dca8ce047c7ab1c74ff7999..7f3ae9df467e2264cac0e188cbab7172b44d18fb 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fgnu-runtime -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fgnu-runtime -o - %s | FileCheck %s
 
 void opaque(void);
 void log(int i);
index 31639466e8bb5d10dc26b983a80d75f67a6913bf..d86422999f61b0e9fa293f0a64b092e1a7cf0e49 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o %t %s
 // RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s
 // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3
 
@@ -12,7 +12,7 @@
 // CHECK-X86_64: define internal void @"\01-[A im0]"
 // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]"
 
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s
 // RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s
 
 // CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
@@ -23,7 +23,7 @@
 // CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
 // CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]"
 
-// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -fobjc-exceptions -emit-llvm -o %t %s
 // RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s
 
 // CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
index 627b913ab06724afe17c86b1e24b07f333ecd18e..af5154a24c27c5becd25f86a4e88ad5216148538 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o - | FileCheck %s
 
 
 extern int printf(const char*, ...);
index b4d21a3f8fccd3657b0f22d35daf3c665c7acb02..fd812dd3882354c8c9d2ace28650bf0b76c8bf6a 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o -
 
 void f0(id x) {
   @synchronized (x) {      
index 884e33a219c09f9af8e2a22ae979fc8f84ce8f44..ba79d6263467e868734601243f31a300ef7fd08c 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -S -o - -triple=i686-apple-darwin9
-// RUN: %clang_cc1 %s -S -o - -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=i686-apple-darwin9
+// RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=x86_64-apple-darwin9
 
 // rdar://6757213 - Don't crash if the internal proto for
 // __objc_personality_v0 mismatches with an actual one.
index 5bfc7dce31a29880f17cc57f454e0272c589e3af..5e4a7a5863b7089fce4f6c1eaab49598d7daa54e 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o - %s | FileCheck --check-prefix=DEFAULT_EH %s
-// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -fexceptions -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck --check-prefix=DEFAULT_EH %s
+// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -fexceptions -fobjc-exceptions -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s
 
 // DEFAULT_EH: declare void @_Unwind_Resume_or_Rethrow(i8*)
 // SJLJ_EH: declare void @_Unwind_SjLj_Resume_or_Rethrow(i8*)
index d9c97d43d46382df7a2337541bb2a254942c6dc3..81c3a6b0ba53b130418483fbc65b5f8229ab759b 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only %s
-// RUN: %clang_cc1 -ast-print %s
-// RUN: %clang_cc1 -ast-dump %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-exceptions %s
+// RUN: %clang_cc1 -ast-print -fobjc-exceptions %s
+// RUN: %clang_cc1 -ast-dump -fobjc-exceptions %s
 
 #include "objc-language-features.inc"
index 6e7790dc5a7020cdbf172dba97a9d26f019aecc8..432637c7e1ac6ed2de88aabf11b147547b829e65 100644 (file)
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-exceptions -fgnu-runtime -emit-llvm -o %t %s
 
 #include "objc-language-features.inc"
index 978b443f0fa663b12f3929c4d921bfeff781e11f..8f6645df515ab5d2730154de64b6fb90f4036596 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
-// RUN: %clang_cc1 -g -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -fobjc-exceptions -o %t %s
+// RUN: %clang_cc1 -g -emit-llvm -fobjc-exceptions -o %t %s
 
 #include "objc-language-features.inc"
index ac77d79c20cb775804baba4e99e25189cad7cc0a..e3d2c0f46d355701456e5aa64f6d67a391420189 100644 (file)
@@ -3,7 +3,7 @@
 // TEST0: clang{{.*}}" "-cc1"
 // TEST0: "-rewrite-objc"
 // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
-// TEST0: "-fmessage-length" "0" "-fdiagnostics-show-option"
+// TEST0: "-fmessage-length" "0" "-fobjc-exceptions" "-fdiagnostics-show-option"
 // TEST0: rewrite-objc.m"
 
 // RUN: not %clang -ccc-no-clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \
index ed7466a53d9e81ead5091f8c9193a20387294ce8..3bc728c35e42b35a1d85f218364cb736a8dd2f6d 100644 (file)
@@ -1,11 +1,11 @@
 // Test this without pch.
-// RUN: %clang_cc1 -include %S/objc_stmts.h -emit-llvm -o - %s
-// RUN: %clang_cc1 -include %S/objc_stmts.h -ast-dump -o - %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -include %S/objc_stmts.h -emit-llvm -fobjc-exceptions -o - %s
+// RUN: %clang_cc1 -include %S/objc_stmts.h -ast-dump -fobjc-exceptions -o - %s 2>&1 | FileCheck %s
 
 // Test with pch.
-// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_stmts.h
-// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s 
-// RUN: %clang_cc1 -include-pch %t -ast-dump -o - %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -x objective-c -emit-pch -fobjc-exceptions -o %t %S/objc_stmts.h
+// RUN: %clang_cc1 -include-pch %t -emit-llvm -fobjc-exceptions -o - %s 
+// RUN: %clang_cc1 -include-pch %t -ast-dump -fobjc-exceptions -o - %s 2>&1 | FileCheck %s
 
 // CHECK: catch parm = "A *a"
 // CHECK: catch parm = "B *b"
index 719369124e5cf4d380a40f3c3d40c63e53c1f954..a3220ebc64774caea97da587393657b03476408a 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -x objective-c++ %s
 void * proc();
 
 @interface NSConstantString
index 7d160cfbdd2b1bb0190d1e11b2b30544c3b26e35..ab5d8387ccabe0cd1292657755f400a5d2053113 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -verify %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-exceptions -verify %s -o -
 
 int main() {
   @try {
index 5bc80b55093ffb9edebf380de3df3385c1e0e6c3..9045f7f766effb00e26767eb9952f9b4fc2e482f 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -o - %s
+// RUN: %clang_cc1 -rewrite-objc -fobjc-exceptions -o - %s
 // rdar://7522880
 
 @interface NSException
index d0c6d2acf67d1bc5692db8e7f3b5bb7f6fa77cd1..5e7b3cf9040762890863e1dae2bf6d22eb43f78c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -rewrite-objc -fobjc-exceptions %s -o -
 
 @interface Foo @end
 @interface GARF @end
index ef1da377094cb9e97563174f89182601d57f2d0c..dcb47640e844ff01a9cccd8ba7ca1d2aee9c3296 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -verify -fobjc-exceptions %s
 @interface A @end
 @protocol P;
 
index 7a642fb10784767099b2f157f7d847c15e68c132..9b7f2c8a975aeb225812b8559085c64e2bba6f82 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fobjc-exceptions
 
 // rdar://6124613
 void test1() {
index 78419a247557c618d00c30ac3fdcfd44bb47ee57..d47f51a84ebf33ed72a374d0fa186a628b2817ac 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fno-objc-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 
 void f() {
   @throw @"Hello"; // expected-error {{cannot use '@throw' with Objective-C exceptions disabled}}
index 72beb67b43e457c2c0ab7c7c9e51978b38306b59..933a4f0673f859ead788da347221348997b944e8 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
 # 1 "<command line>"
 # 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
 typedef signed char BOOL;
index 6b120b28475618545f8e06304b266e47b5059d9e..046992c52fe5beffe4656439fc86ca26dd7485d9 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify -fobjc-exceptions
 // Test case for: 
 //   <rdar://problem/6248119> @finally doesn't introduce a new scope
 
index 116abd19e7e74fb53579ed2f8b9626bbb9f99838..3a626e3696035d9f0520596137092d0943d33a65 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn -fobjc-exceptions
 
 int test1() {
   id a;
index bba321e65766a7e2cad56eb22e347005a9129b17..3f474be6e8df59c8f8940ddcdcfd7c80fbab2157 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
 
 @class A, B, C;
 
index d1e2ad3612e008466ba3e6db5a94ecea9bef1218..d452db8c8b2cf58c8f686802baeeb32f654c3245 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -fobjc-exceptions
 
 struct some_struct;
 
index 01fc4f4f2c565a93547d1eec789e4374953c6012..da06eca470260d3ce49645c44af7844e9b50f64f 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
 typedef signed char BOOL;
 typedef struct _NSZone NSZone;
 
index f649f8c812198681c719fb75f7e6005c55b2804b..221e16ff64782ad19e5f3ba053cf5030a52600ba 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-exception-parameter %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -Wunused-exception-parameter %s
 void  f0() {
   @try {} @catch(id a) {} // expected-warning{{unused exception parameter 'a'}}
 }
index 5e8ec61573d4153d03e84eedae3fb820b8531e7c..ff72858afd3f25c71c3f49efe9f606a336158e0f 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
 
 @interface NSException
 @end