Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.

Update all tests accordingly.

llvm-svn: 126177
This commit is contained in:
Anders Carlsson 2011-02-22 01:52:06 +00:00
parent 919772fd5d
commit 3320e1575f
32 changed files with 48 additions and 48 deletions

View 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">;

View 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,

View 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);

View 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);

View 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()

View 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

View 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);

View 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

View 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*, ...);

View 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) {

View 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.

View 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*)

View 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"

View 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"

View 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"

View 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 | \

View 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"

View 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

View 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 {

View 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

View 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

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify %s
// RUN: %clang_cc1 -verify -fobjc-exceptions %s
@interface A @end
@protocol P;

View 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() {

View 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}}

View 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;

View 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

View 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;

View 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;

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
// RUN: %clang_cc1 %s -verify -fsyntax-only -fobjc-exceptions
struct some_struct;

View 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;

View 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'}}
}

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
@interface NSException
@end