diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-04-19 09:48:46 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-04-19 09:48:46 +0200 |
commit | 5a2fa9e8bf068aaacb57627c058b0d5891763857 (patch) | |
tree | f9163000e53082256164d9a61e169b2713881111 | |
parent | 6e46695631394f346c197cc89ad72233ccfca130 (diff) | |
download | gcc-5a2fa9e8bf068aaacb57627c058b0d5891763857.zip gcc-5a2fa9e8bf068aaacb57627c058b0d5891763857.tar.gz gcc-5a2fa9e8bf068aaacb57627c058b0d5891763857.tar.bz2 |
tree.h (ENUM_IS_SCOPED): Define.
* tree.h (ENUM_IS_SCOPED): Define.
* dwarf2out.c (gen_enumeration_type_die): Add DW_AT_enum_class
for ENUM_IS_SCOPED enums.
cp/
* cp-tree.h (SCOPED_ENUM_P, UNSCOPED_ENUM_P, SET_SCOPED_ENUM_P): Use
ENUM_IS_SCOPED bit instead of TYPE_LANG_FLAG_5.
testsuite/
* g++.dg/debug/dwarf2/enum1.C: New test.
From-SVN: r158505
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/enum1.C | 19 | ||||
-rw-r--r-- | gcc/tree.h | 6 |
7 files changed, 46 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2490cb2..2da24e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-04-19 Jakub Jelinek <jakub@redhat.com> + + * tree.h (ENUM_IS_SCOPED): Define. + * dwarf2out.c (gen_enumeration_type_die): Add DW_AT_enum_class + for ENUM_IS_SCOPED enums. + 2010-04-18 Eric Botcazou <ebotcazou@adacore.com> * fold-const.c (fold_comparison): Use ssizetype. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c59a92..208b745 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-19 Jakub Jelinek <jakub@redhat.com> + + * cp-tree.h (SCOPED_ENUM_P, UNSCOPED_ENUM_P, SET_SCOPED_ENUM_P): Use + ENUM_IS_SCOPED bit instead of TYPE_LANG_FLAG_5. + 2010-04-18 Eric Botcazou <ebotcazou@adacore.com> * decl.c (cxx_init_decl_processing): Remove second argument in call to diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 91f2a9e..22ee2d7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -121,7 +121,6 @@ framework extensions, you must include this file before toplev.h, not after. 3: TYPE_FOR_JAVA. 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) - SCOPED_ENUM_P (in ENUMERAL_TYPE) 6: TYPE_DEPENDENT_P_VALID Usage of DECL_LANG_FLAG_?: @@ -3036,17 +3035,17 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) - The underlying type of the enum is well-defined. */ #define SCOPED_ENUM_P(TYPE) \ - (TREE_CODE (TYPE) == ENUMERAL_TYPE && TYPE_LANG_FLAG_5 (TYPE)) + (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE)) /* Determine whether this is an unscoped enumeration type. */ #define UNSCOPED_ENUM_P(TYPE) \ - (TREE_CODE (TYPE) == ENUMERAL_TYPE && !TYPE_LANG_FLAG_5 (TYPE)) + (TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE)) /* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped enumeration type (1) or a normal (unscoped) enumeration type (0). */ #define SET_SCOPED_ENUM_P(TYPE, VAL) \ - (TYPE_LANG_FLAG_5 (ENUMERAL_TYPE_CHECK (TYPE)) = (VAL)) + (ENUM_IS_SCOPED (TYPE) = (VAL)) /* Returns the underlying type of the given enumeration type. The underlying type is determined in different ways, depending on the diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5a9a3b8..a4cb347 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17385,6 +17385,9 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die) scope_die_for (type, context_die), type); equate_type_number_to_die (type, type_die); add_name_attribute (type_die, type_tag (type)); + if ((dwarf_version >= 4 || !dwarf_strict) + && ENUM_IS_SCOPED (type)) + add_AT_flag (type_die, DW_AT_enum_class, 1); } else if (! TYPE_SIZE (type)) return type_die; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9854516..8ffc442 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-04-19 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/debug/dwarf2/enum1.C: New test. + 2010-04-18 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/rep_clause5.ad[sb]: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/enum1.C b/gcc/testsuite/g++.dg/debug/dwarf2/enum1.C new file mode 100644 index 0000000..b5518ef --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/enum1.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-g -dA -gno-strict-dwarf -std=c++0x" } +// { dg-final { scan-assembler-times "DIE\[^\n\r\]*DW_TAG_enumeration_type" 3 } } +// { dg-final { scan-assembler-times " DW_AT_enum_class" 2 } } + +enum A { a1, a2 } a; +enum struct B { b1, b2 } b; +enum class C { c1, c2 } c; + +void +foo () +{ + a = a1; + a = A::a2; + b = B::b1; + b = B::b2; + c = C::c1; + c = C::c2; +} @@ -457,6 +457,9 @@ struct GTY(()) tree_common { CALL_CANNOT_INLINE_P in CALL_EXPR + + ENUM_IS_SCOPED in + ENUMERAL_TYPE public_flag: @@ -1162,6 +1165,9 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, /* Used to mark a CALL_EXPR as not suitable for inlining. */ #define CALL_CANNOT_INLINE_P(NODE) (CALL_EXPR_CHECK (NODE)->base.static_flag) +/* Used to mark scoped enums. */ +#define ENUM_IS_SCOPED(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.static_flag) + /* In an expr node (usually a conversion) this means the node was made implicitly and should not lead to any sort of warning. In a decl node, warnings concerning the decl should be suppressed. This is used at |