diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-29 12:37:05 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-29 12:37:05 +0000 |
commit | 12cb78d1cca1387a092ec0bd49c250340bff4afc (patch) | |
tree | 1eab97da96906e0a2786d51d9f25f20de02befcf /gcc/cp/search.c | |
parent | 31879e18aea3222fe3e56f2c0319c9f230645ff3 (diff) | |
download | gcc-12cb78d1cca1387a092ec0bd49c250340bff4afc.tar.gz |
2012-08-29 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 190745 using svnmerge, notably
C++ conversion.
[gcc/]
2012-08-29 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with trunk, converted to C++}}
* melt-runtime.h (MELT_FLEXIBLE_DIM): Set when C++.
* melt-runtime.c (melt_tempdir_path): Don't use choose_tmpdir from
libiberty.
(meltgc_start_module_by_index): Use address-of & on VEC_index.
(melt_really_initialize): When printing builtin settings, handle
GCC 4.8 as with implicit ENABLE_BUILD_WITH_CXX.
(meltgc_out_edge): Provide additional flag TDF_DETAILS for dump_edge_info.
(melt_val2passflag): Handle PROP_referenced_vars only when defined.
* melt-module.mk: Use GCCMELT_COMPILER instead of GCCMELT_CC.
* melt-build-script.tpl: Transmit GCCMELT_COMPILER on every make
using melt-module.mk and improve the error message.
* melt-build-script.sh: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@190778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index e6d6be814c6..dc802e4e9a2 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -66,14 +66,12 @@ static tree dfs_get_pure_virtuals (tree, void *); /* Variables for gathering statistics. */ -#ifdef GATHER_STATISTICS static int n_fields_searched; static int n_calls_lookup_field, n_calls_lookup_field_1; static int n_calls_lookup_fnfields, n_calls_lookup_fnfields_1; static int n_calls_get_base_type; static int n_outer_fields_searched; static int n_contexts_saved; -#endif /* GATHER_STATISTICS */ /* Data for lookup_base and its workers. */ @@ -407,9 +405,8 @@ lookup_field_1 (tree type, tree name, bool want_type) { i = (lo + hi) / 2; -#ifdef GATHER_STATISTICS - n_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_fields_searched++; if (DECL_NAME (fields[i]) > name) hi = i; @@ -454,16 +451,16 @@ lookup_field_1 (tree type, tree name, bool want_type) field = TYPE_FIELDS (type); -#ifdef GATHER_STATISTICS - n_calls_lookup_field_1++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_field_1++; + for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) { tree decl = field; -#ifdef GATHER_STATISTICS - n_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_fields_searched++; + gcc_assert (DECL_P (field)); if (DECL_NAME (field) == NULL_TREE && ANON_AGGR_TYPE_P (TREE_TYPE (field))) @@ -579,7 +576,8 @@ context_for_name_lookup (tree decl) declared. */ tree context = DECL_CONTEXT (decl); - while (context && TYPE_P (context) && ANON_AGGR_TYPE_P (context)) + while (context && TYPE_P (context) + && (ANON_AGGR_TYPE_P (context) || UNSCOPED_ENUM_P (context))) context = TYPE_CONTEXT (context); if (!context) context = global_namespace; @@ -623,9 +621,7 @@ dfs_access_in_type (tree binfo, void *data) else { /* First, check for an access-declaration that gives us more - access to the DECL. The CONST_DECL for an enumeration - constant will not have DECL_LANG_SPECIFIC, and thus no - DECL_ACCESS. */ + access to the DECL. */ if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl)) { tree decl_access = purpose_member (type, DECL_ACCESS (decl)); @@ -1204,9 +1200,8 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, if (!basetype_path) return NULL_TREE; -#ifdef GATHER_STATISTICS - n_calls_lookup_field++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_field++; memset (&lfi, 0, sizeof (lfi)); lfi.type = type; @@ -1255,8 +1250,10 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, && !really_overloaded_fn (rval)) { tree decl = is_overloaded_fn (rval) ? get_first_fn (rval) : rval; - if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) - perform_or_defer_access_check (basetype_path, decl, decl); + if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && !perform_or_defer_access_check (basetype_path, decl, decl, + complain)) + rval = error_mark_node; } if (errstr && protect) @@ -1369,9 +1366,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) if (!method_vec) return -1; -#ifdef GATHER_STATISTICS - n_calls_lookup_fnfields_1++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_calls_lookup_fnfields_1++; /* Constructors are first... */ if (name == ctor_identifier) @@ -1407,9 +1403,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) { i = (lo + hi) / 2; -#ifdef GATHER_STATISTICS - n_outer_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_outer_fields_searched++; tmp = VEC_index (tree, method_vec, i); tmp = DECL_NAME (OVL_CURRENT (tmp)); @@ -1424,9 +1419,8 @@ lookup_fnfields_idx_nolazy (tree type, tree name) else for (; VEC_iterate (tree, method_vec, i, fn); ++i) { -#ifdef GATHER_STATISTICS - n_outer_fields_searched++; -#endif /* GATHER_STATISTICS */ + if (GATHER_STATISTICS) + n_outer_fields_searched++; if (DECL_NAME (OVL_CURRENT (fn)) == name) return i; } @@ -2206,28 +2200,28 @@ note_debug_info_needed (tree type) void print_search_statistics (void) { -#ifdef GATHER_STATISTICS + if (! GATHER_STATISTICS) + { + fprintf (stderr, "no search statistics\n"); + return; + } + fprintf (stderr, "%d fields searched in %d[%d] calls to lookup_field[_1]\n", n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1); fprintf (stderr, "%d fnfields searched in %d calls to lookup_fnfields\n", n_outer_fields_searched, n_calls_lookup_fnfields); fprintf (stderr, "%d calls to get_base_type\n", n_calls_get_base_type); -#else /* GATHER_STATISTICS */ - fprintf (stderr, "no search statistics\n"); -#endif /* GATHER_STATISTICS */ } void reinit_search_statistics (void) { -#ifdef GATHER_STATISTICS n_fields_searched = 0; n_calls_lookup_field = 0, n_calls_lookup_field_1 = 0; n_calls_lookup_fnfields = 0, n_calls_lookup_fnfields_1 = 0; n_calls_get_base_type = 0; n_outer_fields_searched = 0; n_contexts_saved = 0; -#endif /* GATHER_STATISTICS */ } /* Helper for lookup_conversions_r. TO_TYPE is the type converted to |