本文整理汇总了C++中TREE_NOTHROW函数的典型用法代码示例。如果您正苦于以下问题:C++ TREE_NOTHROW函数的具体用法?C++ TREE_NOTHROW怎么用?C++ TREE_NOTHROW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TREE_NOTHROW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_end_catch
static tree
do_end_catch (tree type)
{
tree fn, cleanup;
fn = get_identifier ("__cxa_end_catch");
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void __cxa_end_catch (). */
fn = push_void_library_fn (fn, void_list_node);
/* This can throw if the destructor for the exception throws. */
TREE_NOTHROW (fn) = 0;
/* Create its transactional-memory equivalent. */
if (flag_tm)
{
tree fn2 = get_identifier ("_ITM_cxa_end_catch");
if (!get_global_value_if_present (fn2, &fn2))
{
fn2 = push_void_library_fn (fn2, void_list_node);
TREE_NOTHROW (fn2) = 0;
}
apply_tm_attr (fn2, get_identifier ("transaction_pure"));
record_tm_replacement (fn, fn2);
}
}
cleanup = cp_build_function_call_vec (fn, NULL, tf_warning_or_error);
TREE_NOTHROW (cleanup) = dtor_nothrow (type);
return cleanup;
}
示例2: unpack_ts_base_value_fields
static inline void
unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
/* Note that the code for EXPR has already been unpacked to create EXPR in
streamer_alloc_tree. */
if (!TYPE_P (expr))
{
TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_CONSTANT (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
/* TREE_PUBLIC is used on types to indicate that the type
has a TYPE_CACHED_VALUES vector. This is not streamed out,
so we skip it here. */
TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1);
}
else
bp_unpack_value (bp, 4);
TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1);
if (DECL_P (expr))
DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
else if (TYPE_P (expr))
TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
else
bp_unpack_value (bp, 1);
TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TYPE_P (expr))
TYPE_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
else
TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TREE_CODE (expr) != TREE_BINFO)
TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1);
else
bp_unpack_value (bp, 1);
TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TYPE_P (expr))
{
if (AGGREGATE_TYPE_P (expr))
TYPE_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
else
TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8);
}
else if (TREE_CODE (expr) == BIT_FIELD_REF || TREE_CODE (expr) == MEM_REF)
{
REF_REVERSE_STORAGE_ORDER (expr) = (unsigned) bp_unpack_value (bp, 1);
bp_unpack_value (bp, 8);
}
else if (TREE_CODE (expr) == SSA_NAME)
{
SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
bp_unpack_value (bp, 8);
}
else
bp_unpack_value (bp, 9);
}
示例3: init_exception_processing
void
init_exception_processing (void)
{
tree tmp;
/* void std::terminate (); */
push_namespace (std_identifier);
tmp = build_function_type (void_type_node, void_list_node);
terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
TREE_THIS_VOLATILE (terminate_node) = 1;
TREE_NOTHROW (terminate_node) = 1;
pop_namespace ();
/* void __cxa_call_unexpected(void *); */
tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
tmp = build_function_type (void_type_node, tmp);
call_unexpected_node
= push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
? "__gxx_personality_sj0"
: "__gxx_personality_v0");
lang_eh_runtime_type = build_eh_type_type;
lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
}
示例4: do_end_catch
static tree
do_end_catch (tree type)
{
tree fn, cleanup;
fn = get_identifier ("__cxa_end_catch");
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void __cxa_end_catch (). */
fn = push_void_library_fn (fn, void_list_node);
/* This can throw if the destructor for the exception throws. */
TREE_NOTHROW (fn) = 0;
}
cleanup = build_function_call (fn, NULL_TREE);
TREE_NOTHROW (cleanup) = dtor_nothrow (type);
return cleanup;
}
示例5: maybe_noexcept_warning
static void
maybe_noexcept_warning (tree fn)
{
if (TREE_NOTHROW (fn))
{
warning (OPT_Wnoexcept, "noexcept-expression evaluates to %<false%> "
"because of a call to %qD", fn);
warning (OPT_Wnoexcept, "but %q+D does not throw; perhaps "
"it should be declared %<noexcept%>", fn);
}
}
示例6: dtor_nothrow
static int
dtor_nothrow (tree type)
{
if (type == NULL_TREE)
return 0;
if (! TYPE_HAS_DESTRUCTOR (type))
return 1;
return TREE_NOTHROW (CLASSTYPE_DESTRUCTORS (type));
}
示例7: handle_nothrow_attribute
static tree
handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
if (TREE_CODE (*node) == FUNCTION_DECL)
TREE_NOTHROW (*node) = 1;
else
gcc_unreachable ();
return NULL_TREE;
}
示例8: dtor_nothrow
static int
dtor_nothrow (tree type)
{
if (type == NULL_TREE)
return 0;
if (!CLASS_TYPE_P (type))
return 1;
if (CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
return TREE_NOTHROW (CLASSTYPE_DESTRUCTORS (type));
}
示例9: dtor_nothrow
static int
dtor_nothrow (tree type)
{
if (type == NULL_TREE || type == error_mark_node)
return 0;
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
return 1;
if (CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
return TREE_NOTHROW (CLASSTYPE_DESTRUCTOR (type));
}
示例10: pack_ts_base_value_fields
static void
pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
bp_pack_value (bp, TREE_CODE (expr), 16);
if (!TYPE_P (expr))
{
bp_pack_value (bp, TREE_SIDE_EFFECTS (expr), 1);
bp_pack_value (bp, TREE_CONSTANT (expr), 1);
bp_pack_value (bp, TREE_READONLY (expr), 1);
/* TREE_PUBLIC is used on types to indicate that the type
has a TYPE_CACHED_VALUES vector. This is not streamed out,
so we skip it here. */
bp_pack_value (bp, TREE_PUBLIC (expr), 1);
}
else
bp_pack_value (bp, 0, 4);
bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1);
bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1);
if (DECL_P (expr))
bp_pack_value (bp, DECL_UNSIGNED (expr), 1);
else if (TYPE_P (expr))
bp_pack_value (bp, TYPE_UNSIGNED (expr), 1);
else
bp_pack_value (bp, 0, 1);
/* We write debug info two times, do not confuse the second one.
The only relevant TREE_ASM_WRITTEN use is on SSA names. */
bp_pack_value (bp, (TREE_CODE (expr) != SSA_NAME
? 0 : TREE_ASM_WRITTEN (expr)), 1);
if (TYPE_P (expr))
bp_pack_value (bp, TYPE_ARTIFICIAL (expr), 1);
else
bp_pack_value (bp, TREE_NO_WARNING (expr), 1);
bp_pack_value (bp, TREE_NOTHROW (expr), 1);
bp_pack_value (bp, TREE_STATIC (expr), 1);
if (TREE_CODE (expr) != TREE_BINFO)
bp_pack_value (bp, TREE_PRIVATE (expr), 1);
bp_pack_value (bp, TREE_PROTECTED (expr), 1);
bp_pack_value (bp, TREE_DEPRECATED (expr), 1);
if (TYPE_P (expr))
{
bp_pack_value (bp, TYPE_SATURATING (expr), 1);
bp_pack_value (bp, TYPE_ADDR_SPACE (expr), 8);
}
else if (TREE_CODE (expr) == SSA_NAME)
bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
else
bp_pack_value (bp, 0, 1);
}
示例11: do_end_catch
static tree
do_end_catch (tree type)
{
tree fn, cleanup;
/* APPLE LOCAL begin radar 2848255 */
if (c_dialect_objc () && objc2_valid_objc_catch_type (type))
fn = get_identifier ("objc_end_catch");
else
fn = get_identifier ("__cxa_end_catch");
/* APPLE LOCAL end radar 2848255 */
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void __cxa_end_catch (). */
fn = push_void_library_fn (fn, void_list_node);
/* This can throw if the destructor for the exception throws. */
TREE_NOTHROW (fn) = 0;
}
cleanup = build_function_call (fn, NULL_TREE);
TREE_NOTHROW (cleanup) = dtor_nothrow (type);
return cleanup;
}
示例12: do_end_catch
static tree
do_end_catch (tree type)
{
if (!end_catch_fn)
/* Declare void __cxa_end_catch ().
This can throw if the destructor for the exception throws. */
end_catch_fn
= declare_library_fn ("__cxa_end_catch", void_type_node,
NULL_TREE, 0, ECF_TM_PURE);
tree cleanup = cp_build_function_call_vec (end_catch_fn,
NULL, tf_warning_or_error);
TREE_NOTHROW (cleanup) = dtor_nothrow (type);
return cleanup;
}
示例13: declare_cilk_for_builtin
static tree
declare_cilk_for_builtin (const char *name, tree type,
enum built_in_function code)
{
tree cb, ft, fn;
cb = build_function_type_list (void_type_node,
ptr_type_node, type, type,
NULL_TREE);
cb = build_pointer_type (cb);
ft = build_function_type_list (void_type_node,
cb, ptr_type_node, type,
integer_type_node, NULL_TREE);
fn = install_builtin (name, ft, code, false);
TREE_NOTHROW (fn) = 0;
return fn;
}
示例14: init_exception_processing
void
init_exception_processing (void)
{
tree tmp;
/* void std::terminate (); */
push_namespace (std_identifier);
tmp = build_function_type_list (void_type_node, NULL_TREE);
terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
TREE_THIS_VOLATILE (terminate_node) = 1;
TREE_NOTHROW (terminate_node) = 1;
pop_namespace ();
/* void __cxa_call_unexpected(void *); */
tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
call_unexpected_node
= push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
}
示例15: check_noexcept_r
static tree
check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/)
{
tree t = *tp;
enum tree_code code = TREE_CODE (t);
if ((code == CALL_EXPR && CALL_EXPR_FN (t))
|| code == AGGR_INIT_EXPR)
{
/* We can only use the exception specification of the called function
for determining the value of a noexcept expression; we can't use
TREE_NOTHROW, as it might have a different value in another
translation unit, creating ODR problems.
We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */
tree fn = (code == AGGR_INIT_EXPR
? AGGR_INIT_EXPR_FN (t) : CALL_EXPR_FN (t));
tree type = TREE_TYPE (fn);
gcc_assert (POINTER_TYPE_P (type));
type = TREE_TYPE (type);
STRIP_NOPS (fn);
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
if (TREE_CODE (fn) == FUNCTION_DECL)
{
/* We do use TREE_NOTHROW for ABI internals like __dynamic_cast,
and for C library functions known not to throw. */
if (DECL_EXTERN_C_P (fn)
&& (DECL_ARTIFICIAL (fn)
|| nothrow_libfn_p (fn)))
return TREE_NOTHROW (fn) ? NULL_TREE : fn;
/* A call to a constexpr function is noexcept if the call
is a constant expression. */
if (DECL_DECLARED_CONSTEXPR_P (fn)
&& is_sub_constant_expr (t))
return NULL_TREE;
}
if (!TYPE_NOTHROW_P (type))
return fn;
}
return NULL_TREE;
}