[llvm-commits] [llvm-gcc-4.2] r118750 - in /llvm-gcc-4.2/trunk/gcc: c-opts.c calls.c common.opt config/arm/darwin.h config/darwin.h cp/decl.c cp/init.c dwarf2out.c function.c opts.c tree-eh.c tree-ssa-math-opts.c
Stuart Hastings
stuart at apple.com
Wed Nov 10 16:37:14 PST 2010
Author: stuart
Date: Wed Nov 10 18:37:14 2010
New Revision: 118750
URL: http://llvm.org/viewvc/llvm-project?rev=118750&view=rev
Log:
Support -fno-exceptions in Objective-C++.
Tweaked flag_exceptions from a binary into a trinary variable.
Modified:
llvm-gcc-4.2/trunk/gcc/c-opts.c
llvm-gcc-4.2/trunk/gcc/calls.c
llvm-gcc-4.2/trunk/gcc/common.opt
llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h
llvm-gcc-4.2/trunk/gcc/config/darwin.h
llvm-gcc-4.2/trunk/gcc/cp/decl.c
llvm-gcc-4.2/trunk/gcc/cp/init.c
llvm-gcc-4.2/trunk/gcc/dwarf2out.c
llvm-gcc-4.2/trunk/gcc/function.c
llvm-gcc-4.2/trunk/gcc/opts.c
llvm-gcc-4.2/trunk/gcc/tree-eh.c
llvm-gcc-4.2/trunk/gcc/tree-ssa-math-opts.c
Modified: llvm-gcc-4.2/trunk/gcc/c-opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-opts.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-opts.c Wed Nov 10 18:37:14 2010
@@ -237,7 +237,10 @@
#endif
/* APPLE LOCAL end -Wfour-char-constants */
- flag_exceptions = c_dialect_cxx ();
+ /* LLVM LOCAL begin 6635085 */
+ if (c_dialect_cxx() && flag_exceptions < 0)
+ flag_exceptions = 1;
+ /* LLVM LOCAL end 6635085 */
/* LLVM local begin One Definition Rule */
#ifdef ENABLE_LLVM
flag_odr = c_dialect_cxx ();
@@ -1153,7 +1156,10 @@
/* Default to ObjC sjlj exception handling if NeXT runtime. */
if (flag_objc_sjlj_exceptions < 0)
flag_objc_sjlj_exceptions = flag_next_runtime;
- if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
+ /* LLVM LOCAL begin 6635085 */
+ if ((flag_objc_exceptions && !flag_objc_sjlj_exceptions)
+ || flag_exceptions < 0)
+ /* LLVM LOCAL end 6635085 */
flag_exceptions = 1;
/* -Wextra implies -Wsign-compare, -Wmissing-field-initializers and
Modified: llvm-gcc-4.2/trunk/gcc/calls.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/calls.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/calls.c (original)
+++ llvm-gcc-4.2/trunk/gcc/calls.c Wed Nov 10 18:37:14 2010
@@ -2384,6 +2384,8 @@
with stack pointer depressed.
Also do the adjustments before a throwing call, otherwise
exception handling can fail; PR 19225. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions > 0);
if (pending_stack_adjust >= 32
|| (pending_stack_adjust > 0
&& (flags & (ECF_MAY_BE_ALLOCA | ECF_SP_DEPRESSED)))
Modified: llvm-gcc-4.2/trunk/gcc/common.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/common.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/common.opt Wed Nov 10 18:37:14 2010
@@ -519,7 +519,7 @@
Do not suppress C++ class debug information.
fexceptions
-Common Report Var(flag_exceptions)
+Common Report Var(flag_exceptions) Init(-1)
Enable exception handling
; APPLE LOCAL begin optimization pragmas 3124235/3420242
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/darwin.h Wed Nov 10 18:37:14 2010
@@ -382,7 +382,9 @@
#define OBJC_TARGET_FLAG_OBJC_ABI \
do { \
- if (flag_objc_abi == -1) \
+ /* LLVM LOCAL 6635085 */ \
+ if (flag_objc_abi == -1 \
+ && flag_exceptions == -1) \
flag_objc_abi = 2; \
if (flag_objc_legacy_dispatch == -1) \
flag_objc_legacy_dispatch = 1; \
Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Nov 10 18:37:14 2010
@@ -863,7 +863,10 @@
flag_objc_zerocost_exceptions = 1; \
if (flag_objc_zerocost_exceptions) \
{ \
- flag_exceptions = 1; \
+ /* APPLE LOCAL begin 6635085 */ \
+ if (flag_exceptions == -1) \
+ flag_exceptions = 1; \
+ /* APPLE LOCAL end 6635085 */ \
flag_objc_sjlj_exceptions = 0; \
} \
/* APPLE LOCAL end radar 5023725 */ \
Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Wed Nov 10 18:37:14 2010
@@ -1104,6 +1104,8 @@
all declarations, including the definition and an explicit
specialization, of that function shall have an
exception-specification with the same set of type-ids. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl))
&& ! DECL_IS_BUILTIN (old_decl)
&& flag_exceptions
@@ -3393,7 +3395,8 @@
init_class_processing ();
init_rtti_processing ();
- if (flag_exceptions)
+ /* LLVM LOCAL 6635085 */
+ if (flag_exceptions > 0)
init_exception_processing ();
if (! supports_one_only ())
@@ -11736,6 +11739,8 @@
static bool
use_eh_spec_block (tree fn)
{
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
return (flag_exceptions && flag_enforce_eh_specs
&& !processing_template_decl
&& TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))
Modified: llvm-gcc-4.2/trunk/gcc/cp/init.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/init.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/init.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/init.c Wed Nov 10 18:37:14 2010
@@ -1957,6 +1957,8 @@
unambiguous matching deallocation function can be found,
propagating the exception does not cause the object's memory to be
freed. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if (flag_exceptions && ! use_java_new)
{
enum tree_code dcode = array_p ? VEC_DELETE_EXPR : DELETE_EXPR;
@@ -2495,6 +2497,8 @@
/* Protect the entire array initialization so that we can destroy
the partially constructed array if an exception is thrown.
But don't do this if we're assigning. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if (flag_exceptions && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& from_array != 2)
{
@@ -2629,6 +2633,8 @@
}
/* Make sure to cleanup any partially constructed elements. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if (flag_exceptions && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& from_array != 2)
{
Modified: llvm-gcc-4.2/trunk/gcc/dwarf2out.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dwarf2out.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/dwarf2out.c (original)
+++ llvm-gcc-4.2/trunk/gcc/dwarf2out.c Wed Nov 10 18:37:14 2010
@@ -123,7 +123,8 @@
#ifdef DWARF2_UNWIND_INFO
|| (DWARF2_UNWIND_INFO
&& (flag_unwind_tables
- || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)))
+ /* LLVM LOCAL 6635085 */
+ || (flag_exceptions > 0 && ! USING_SJLJ_EXCEPTIONS)))
#endif
);
}
@@ -2207,6 +2208,8 @@
discarded. Example where this matters: a primary function
template in C++ requires EH information, but an explicit
specialization doesn't. */
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if (TARGET_USES_WEAK_UNWIND_INFO
&& ! flag_asynchronous_unwind_tables
/* APPLE LOCAL begin for-fsf-4_4 5480287 */ \
@@ -2380,6 +2383,8 @@
floor_log2 (for_eh ? PTR_SIZE : DWARF2_ADDR_SIZE));
ASM_OUTPUT_LABEL (asm_out_file, l2);
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
/* Loop through all of the FDE's. */
for (i = 0; i < fde_table_in_use; i++)
{
@@ -2664,7 +2669,8 @@
#ifndef TARGET_UNWIND_INFO
/* Output another copy for the unwinder. */
- if (! USING_SJLJ_EXCEPTIONS && (flag_unwind_tables || flag_exceptions))
+ /* LLVM LOCAL 6635085 */
+ if (! USING_SJLJ_EXCEPTIONS && (flag_unwind_tables || flag_exceptions > 0))
output_call_frame_info (1);
#endif
}
Modified: llvm-gcc-4.2/trunk/gcc/function.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/function.c (original)
+++ llvm-gcc-4.2/trunk/gcc/function.c Wed Nov 10 18:37:14 2010
@@ -4475,6 +4475,8 @@
/* Output the label for the actual return from the function. */
emit_label (return_label);
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions > 0);
if (USING_SJLJ_EXCEPTIONS)
{
/* Let except.c know where it should emit the call to unregister
Modified: llvm-gcc-4.2/trunk/gcc/opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/opts.c Wed Nov 10 18:37:14 2010
@@ -736,7 +736,8 @@
generating unwind info. If flag_exceptions is turned on we need to
turn off the partitioning optimization. */
- if (flag_exceptions && flag_reorder_blocks_and_partition)
+ /* LLVM LOCAL 6635085 */
+ if (flag_exceptions > 0 && flag_reorder_blocks_and_partition)
{
inform
("-freorder-blocks-and-partition does not work with exceptions");
Modified: llvm-gcc-4.2/trunk/gcc/tree-eh.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-eh.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-eh.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-eh.c Wed Nov 10 18:37:14 2010
@@ -1355,6 +1355,11 @@
struct leh_state this_state;
int ndests;
+ /* LLVM LOCAL begin 6635085 */
+ /* if ( ! flag_exceptions)
+ fatal_error("try/catch constructs require -fexceptions"); */
+ /* LLVM LOCAL end 6635085 */
+
/* Process the try block. */
memset (&this_tf, 0, sizeof (this_tf));
Modified: llvm-gcc-4.2/trunk/gcc/tree-ssa-math-opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-ssa-math-opts.c?rev=118750&r1=118749&r2=118750&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-ssa-math-opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-ssa-math-opts.c Wed Nov 10 18:37:14 2010
@@ -259,6 +259,8 @@
if (occ_child->children)
compute_merit (occ_child);
+ /* LLVM LOCAL 6635085 */
+ gcc_assert(flag_exceptions >= 0);
if (flag_exceptions)
bb = single_noncomplex_succ (dom);
else
More information about the llvm-commits
mailing list