diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-08-21 17:11:49 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-08-21 17:11:49 +0000 |
commit | 8e063904ef8bb900f2eeb01106abca25cdd8a8cc (patch) | |
tree | 6f651117808c9536140530ecc5d8ef5cea496a09 /gcc/cp/search.c | |
parent | 57cea2b3bc9cc19bc3d14007cef0393f5bf70823 (diff) | |
download | gcc-8e063904ef8bb900f2eeb01106abca25cdd8a8cc.zip gcc-8e063904ef8bb900f2eeb01106abca25cdd8a8cc.tar.gz gcc-8e063904ef8bb900f2eeb01106abca25cdd8a8cc.tar.bz2 |
search.c (lookup_field_1): Assert TYPE is a class and VFIELD isn't special.
* search.c (lookup_field_1): Assert TYPE is a class and VFIELD
isn't special.
(lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
(lookup_field_fuzzy_r): Adjust.
From-SVN: r251241
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index ced82da..a1c4ba1 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -371,18 +371,7 @@ lookup_field_1 (tree type, tree name, bool want_type) { tree field; - gcc_assert (identifier_p (name)); - - if (TREE_CODE (type) == TEMPLATE_TYPE_PARM - || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM - || TREE_CODE (type) == TYPENAME_TYPE) - /* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and - BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all; - instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously, - the code often worked even when we treated the index as a list - of fields!) - The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */ - return NULL_TREE; + gcc_assert (identifier_p (name) && RECORD_OR_UNION_TYPE_P (type)); if (CLASSTYPE_SORTED_FIELDS (type)) { @@ -474,13 +463,11 @@ lookup_field_1 (tree type, tree name, bool want_type) && (!want_type || DECL_DECLARES_TYPE_P (decl))) return decl; } - /* Not found. */ - if (name == vptr_identifier) - { - /* Give the user what s/he thinks s/he wants. */ - if (TYPE_POLYMORPHIC_P (type)) - return TYPE_VFIELD (type); - } + + /* We used to special-case vptr_identifier. Make sure it's not + special any more. */ + gcc_assert (name != vptr_identifier || !TYPE_VFIELD (type)); + return NULL_TREE; } @@ -1374,7 +1361,6 @@ class lookup_field_fuzzy_info lookup_field_fuzzy_info (bool want_type_p) : m_want_type_p (want_type_p), m_candidates () {} - void fuzzy_lookup_fnfields (tree type); void fuzzy_lookup_field (tree type); /* If true, we are looking for types, not data members. */ @@ -1383,27 +1369,6 @@ class lookup_field_fuzzy_info auto_vec<tree> m_candidates; }; -/* Locate all methods within TYPE, append them to m_candidates. */ - -void -lookup_field_fuzzy_info::fuzzy_lookup_fnfields (tree type) -{ - vec<tree, va_gc> *method_vec; - tree fn; - size_t i; - - if (!CLASS_TYPE_P (type)) - return; - - method_vec = CLASSTYPE_METHOD_VEC (type); - if (!method_vec) - return; - - for (i = 0; vec_safe_iterate (method_vec, i, &fn); ++i) - if (fn) - m_candidates.safe_push (OVL_NAME (fn)); -} - /* Locate all fields within TYPE, append them to m_candidates. */ void @@ -1432,11 +1397,6 @@ lookup_field_fuzzy_r (tree binfo, void *data) lookup_field_fuzzy_info *lffi = (lookup_field_fuzzy_info *) data; tree type = BINFO_TYPE (binfo); - /* First, look for functions. */ - if (!lffi->m_want_type_p) - lffi->fuzzy_lookup_fnfields (type); - - /* Look for data member and types. */ lffi->fuzzy_lookup_field (type); return NULL_TREE; |