diff options
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r-- | gcc/cp/except.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c index d7d009bdd69..221971ac956 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1,5 +1,5 @@ /* Handle exceptional things in C++. - Copyright (C) 1989-2013 Free Software Foundation, Inc. + Copyright (C) 1989-2014 Free Software Foundation, Inc. Contributed by Michael Tiemann <tiemann@cygnus.com> Rewritten by Mike Stump <mrs@cygnus.com>, based upon an initial re-implementation courtesy Tad Hunt. @@ -1342,4 +1342,22 @@ build_noexcept_spec (tree expr, int complain) } } +/* Returns a TRY_CATCH_EXPR that will put TRY_LIST and CATCH_LIST in the + TRY and CATCH locations. CATCH_LIST must be a STATEMENT_LIST */ + +tree +create_try_catch_expr (tree try_expr, tree catch_list) +{ + location_t loc = EXPR_LOCATION (try_expr); + + append_to_statement_list (do_begin_catch (), &catch_list); + append_to_statement_list (build_throw (NULL_TREE), &catch_list); + tree catch_tf_expr = build_stmt (loc, TRY_FINALLY_EXPR, catch_list, + do_end_catch (NULL_TREE)); + catch_list = build2 (CATCH_EXPR, void_type_node, NULL_TREE, + catch_tf_expr); + tree try_catch_expr = build_stmt (loc, TRY_CATCH_EXPR, try_expr, catch_list); + return try_catch_expr; +} + #include "gt-cp-except.h" |