aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-11 17:30:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-11 17:30:02 -0400
commit9b41f0d3273a3a8561eebeec150357d80ed09819 (patch)
tree508374ae54a7a6e5aee9bdd77ed8d4a42f454f17 /gcc
parentefd115c1c6e42f689659802e4eab60c455a53579 (diff)
downloadgcc-9b41f0d3273a3a8561eebeec150357d80ed09819.zip
gcc-9b41f0d3273a3a8561eebeec150357d80ed09819.tar.gz
gcc-9b41f0d3273a3a8561eebeec150357d80ed09819.tar.bz2
semantics.c (register_constexpr_fundef): Add to hash table here.
* semantics.c (register_constexpr_fundef): Add to hash table here. (validate_constexpr_fundecl): Not here. From-SVN: r173681
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/semantics.c39
2 files changed, 21 insertions, 21 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d6241cd..6452fd6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2011-05-11 Jason Merrill <jason@redhat.com>
+ * semantics.c (register_constexpr_fundef): Add to hash table here.
+ (validate_constexpr_fundecl): Not here.
+
* decl.c (grokdeclarator): Only set DECL_DECLARED_CONSTEXPR_P once.
* pt.c (build_non_dependent_expr): Don't check null_ptr_cst_p,
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index bfe233e..e12f036 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5456,9 +5456,6 @@ is_valid_constexpr_fn (tree fun, bool complain)
tree
validate_constexpr_fundecl (tree fun)
{
- constexpr_fundef entry;
- constexpr_fundef **slot;
-
if (processing_template_decl || !DECL_DECLARED_CONSTEXPR_P (fun))
return NULL;
else if (DECL_CLONED_FUNCTION_P (fun))
@@ -5471,21 +5468,6 @@ validate_constexpr_fundecl (tree fun)
return NULL;
}
- /* Create the constexpr function table if necessary. */
- if (constexpr_fundef_table == NULL)
- constexpr_fundef_table = htab_create_ggc (101,
- constexpr_fundef_hash,
- constexpr_fundef_equal,
- ggc_free);
- entry.decl = fun;
- entry.body = NULL;
- slot = (constexpr_fundef **)
- htab_find_slot (constexpr_fundef_table, &entry, INSERT);
- if (*slot == NULL)
- {
- *slot = ggc_alloc_constexpr_fundef ();
- **slot = entry;
- }
return fun;
}
@@ -5722,8 +5704,8 @@ constexpr_fn_retval (tree body)
tree
register_constexpr_fundef (tree fun, tree body)
{
- constexpr_fundef *fundef = retrieve_constexpr_fundef (fun);
- gcc_assert (fundef != NULL && fundef->body == NULL);
+ constexpr_fundef entry;
+ constexpr_fundef **slot;
if (DECL_CONSTRUCTOR_P (fun))
body = build_constexpr_constructor_member_initializers
@@ -5754,7 +5736,22 @@ register_constexpr_fundef (tree fun, tree body)
require_potential_rvalue_constant_expression (body);
return NULL;
}
- fundef->body = body;
+
+ /* Create the constexpr function table if necessary. */
+ if (constexpr_fundef_table == NULL)
+ constexpr_fundef_table = htab_create_ggc (101,
+ constexpr_fundef_hash,
+ constexpr_fundef_equal,
+ ggc_free);
+ entry.decl = fun;
+ entry.body = body;
+ slot = (constexpr_fundef **)
+ htab_find_slot (constexpr_fundef_table, &entry, INSERT);
+
+ gcc_assert (*slot == NULL);
+ *slot = ggc_alloc_constexpr_fundef ();
+ **slot = entry;
+
return fun;
}