From 4edbc4c4355eb3c95a8f87f8d0f4e68feeec29d2 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 12 Apr 2019 11:41:44 +0000 Subject: [PATCH] Ownership only on namespace-scope. gcc/cp/ * module.cc (dumper::impl::nested_name): Show decl's ownership. (trees_out::tree_decl): Remove unnecessary unnameable code. (depset::hash::add_dependency): Add is_import parm. (module_state::write_clister): Get owner decl of unnamed. (get_module_owner): Always look at the namespace-scope entity. (set_module_owner): Only set namespace-scope entity. (set_implicit_module_owner): Likewise. gcc/testsuite/ * g++.dg/modules/by-name-1.C: Adjust scans. * g++.dg/modules/class-3_[bd].C: Likewise. * g++.dg/modules/enum-1_a.C: Likewise. * g++.dg/modules/global-[23]_a.C: Likewise. * g++.dg/modules/indirect-[1234]_[bc].C: Likewise. * g++.dg/modules/part-3_c.C: Likewise. * g++.dg/modules/scc-1.C: Likewise. * g++.dg/modules/stdio-1_a.H: Likewise. * g++.dg/modules/using-4_a.C: Likewise. * g++.dg/modules/vmort-2_[abc].C: Likewise. From-SVN: r270311 --- ChangeLog.modules | 23 +++ gcc/cp/module.cc | 188 ++++++++------------ gcc/testsuite/g++.dg/modules/by-name-1.C | 4 +- gcc/testsuite/g++.dg/modules/class-3_b.C | 10 +- gcc/testsuite/g++.dg/modules/class-3_d.C | 10 +- gcc/testsuite/g++.dg/modules/enum-1_a.C | 2 +- gcc/testsuite/g++.dg/modules/global-2_a.C | 2 +- gcc/testsuite/g++.dg/modules/global-3_a.C | 2 +- gcc/testsuite/g++.dg/modules/indirect-1_b.C | 18 +- gcc/testsuite/g++.dg/modules/indirect-1_c.C | 14 +- gcc/testsuite/g++.dg/modules/indirect-2_b.C | 8 +- gcc/testsuite/g++.dg/modules/indirect-2_c.C | 8 +- gcc/testsuite/g++.dg/modules/indirect-3_b.C | 10 +- gcc/testsuite/g++.dg/modules/indirect-3_c.C | 10 +- gcc/testsuite/g++.dg/modules/indirect-4_b.C | 8 +- gcc/testsuite/g++.dg/modules/indirect-4_c.C | 8 +- gcc/testsuite/g++.dg/modules/part-3_c.C | 4 +- gcc/testsuite/g++.dg/modules/scc-1.C | 8 +- gcc/testsuite/g++.dg/modules/stdio-1_a.H | 2 +- gcc/testsuite/g++.dg/modules/using-4_a.C | 2 +- gcc/testsuite/g++.dg/modules/vmort-2_a.C | 6 +- gcc/testsuite/g++.dg/modules/vmort-2_b.C | 6 +- gcc/testsuite/g++.dg/modules/vmort-2_c.C | 2 +- 23 files changed, 170 insertions(+), 185 deletions(-) diff --git a/ChangeLog.modules b/ChangeLog.modules index 6f4983bc5299..725ac11a62d6 100644 --- a/ChangeLog.modules +++ b/ChangeLog.modules @@ -1,3 +1,26 @@ +2019-04-12 Nathan Sidwell + + Ownership only on namespace-scope. + gcc/cp/ + * module.cc (dumper::impl::nested_name): Show decl's ownership. + (trees_out::tree_decl): Remove unnecessary unnameable code. + (depset::hash::add_dependency): Add is_import parm. + (module_state::write_clister): Get owner decl of unnamed. + (get_module_owner): Always look at the namespace-scope entity. + (set_module_owner): Only set namespace-scope entity. + (set_implicit_module_owner): Likewise. + gcc/testsuite/ + * g++.dg/modules/by-name-1.C: Adjust scans. + * g++.dg/modules/class-3_[bd].C: Likewise. + * g++.dg/modules/enum-1_a.C: Likewise. + * g++.dg/modules/global-[23]_a.C: Likewise. + * g++.dg/modules/indirect-[1234]_[bc].C: Likewise. + * g++.dg/modules/part-3_c.C: Likewise. + * g++.dg/modules/scc-1.C: Likewise. + * g++.dg/modules/stdio-1_a.H: Likewise. + * g++.dg/modules/using-4_a.C: Likewise. + * g++.dg/modules/vmort-2_[abc].C: Likewise. + 2019-04-11 Nathan Sidwell gcc/cp/ diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 88c064141856..175b1b1e1fc4 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -2426,7 +2426,7 @@ public: public: void add_mergeable (depset *); - void add_dependency (tree decl, entity_kind); + void add_dependency (tree decl, entity_kind, bool is_import = false); void add_binding (tree ns, tree value); void add_writables (tree ns, bitmap partitions); void find_dependencies (); @@ -3648,6 +3648,7 @@ bool dumper::impl::nested_name (tree t) { tree ti = NULL_TREE; + unsigned owner = MODULE_NONE; if (t && TREE_CODE (t) == TREE_BINFO) t = BINFO_TYPE (t); @@ -3663,6 +3664,12 @@ dumper::impl::nested_name (tree t) if (TREE_CODE (ctx) == TRANSLATION_UNIT_DECL || nested_name (ctx)) fputs ("::", stream); + + if (TREE_CODE (t) != NAMESPACE_DECL + || DECL_NAMESPACE_ALIAS (t) + || (!TREE_PUBLIC (t) && TREE_PUBLIC (CP_DECL_CONTEXT (t)))) + owner = MAYBE_DECL_MODULE_OWNER (t); + int use_tpl; // FIXME: See avoidance of TEMPLATE_DECL in node_template_info if (TREE_CODE (t) == TEMPLATE_DECL) @@ -3699,6 +3706,13 @@ dumper::impl::nested_name (tree t) else fputs ("#null#", stream); + if (owner != MODULE_NONE) + { + fputs ("@(", stream); + fputs ((*modules)[owner]->get_flatname (), stream); + fputs (")", stream); + } + if (ti) { tree args = INNERMOST_TEMPLATE_ARGS (TI_ARGS (ti)); @@ -6529,49 +6543,25 @@ trees_out::tree_decl (tree decl, walk_kind ref, bool looking_inside) || DECL_MEMBER_TEMPLATE_P (decl) || owner < MODULE_IMPORT_BASE); - if (TREE_CODE (owner_decl) == FUNCTION_DECL - && owner_decl != STRIP_TEMPLATE (decl)) - { - /* We cannot look up inside a function by name. */ - gcc_assert (owner < MODULE_IMPORT_BASE); - - return true; - } - - bool is_import = owner >= MODULE_IMPORT_BASE; tree ctx = CP_DECL_CONTEXT (decl); + bool is_import = owner >= MODULE_IMPORT_BASE; if (TREE_CODE (ctx) == FUNCTION_DECL) { - /* Some internal decl of the function. */ - if (!DECL_IMPLICIT_TYPEDEF_P (decl)) - return true; - - if (!streaming_p ()) + /* We cannot lookup by name inside a function. */ + if (!streaming_p () + && (dep_hash->sneakoscope || is_import)) { - bool unnameable = dep_hash->sneakoscope || is_import; - if (!unnameable) - { - /* If the owning function is not within - dep_hash->current, it is also a voldemort. */ - - // FIXME: For now, not nested of nested. Here it'd be - // nice to just call the context dumper and get some - // kind of result back 'hey, you're voldemorty' - gcc_assert (TREE_CODE (CP_DECL_CONTEXT (ctx)) == NAMESPACE_DECL); - if (dep_hash->current->get_entity () != ctx) - unnameable = true; - } - - if (unnameable) - { - /* We've found a voldemort type. Add it as a - dependency. */ - dep_hash->add_dependency (decl, depset::EK_UNNAMED); - kind = "unnamed"; - goto insert; - } + /* We've found a voldemort type. Add it as a + dependency. */ + dep_hash->add_dependency (decl, depset::EK_UNNAMED, is_import); + kind = "unnamed"; + goto insert; } + + /* Some internal entity of the function. Do by value. */ + gcc_assert (!is_import); + return true; } /* A named decl -> tt_named_decl. */ @@ -8671,7 +8661,7 @@ depset::hash::find_binding (tree ctx, tree name) a using decl. */ void -depset::hash::add_dependency (tree decl, entity_kind ek) +depset::hash::add_dependency (tree decl, entity_kind ek, bool is_import) { /* Make sure we're being told consistent information. */ gcc_checking_assert ((ek == EK_USING) == (TREE_CODE (decl) == OVERLOAD)); @@ -8679,6 +8669,7 @@ depset::hash::add_dependency (tree decl, entity_kind ek) == (TREE_CODE (decl) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (decl))); gcc_checking_assert (ek != EK_BINDING); + gcc_checking_assert (!is_import || ek == EK_UNNAMED); if (depset **slot = entity_slot (decl, !is_mergeable_dep ())) { @@ -8711,10 +8702,9 @@ depset::hash::add_dependency (tree decl, entity_kind ek) below checks to this entity, because we can only refer to it by depending on its containing entity, and that entity will have the below checks applied to it. */; - unsigned owner = (*modules)[MAYBE_DECL_MODULE_OWNER (decl)]->remap; - /* Note this entity came from elsewhere. */ - if (owner >= MODULE_IMPORT_BASE) + if (is_import) + /* Note this entity came from elsewhere. */ dep->set_flag_bit (); } else @@ -10809,7 +10799,8 @@ module_state::write_cluster (elf_out *to, depset *scc[], unsigned size, unsigned index = d->cluster - 1; if (is_imported) { - owner = MAYBE_DECL_MODULE_OWNER (u_decl); + tree o_decl = get_module_owner (u_decl); + owner = MAYBE_DECL_MODULE_OWNER (o_decl); module_state *import = (*modules)[owner]; /* It must be in the unnamed map. */ index = *unnamed_map->get (DECL_UID (u_decl)); @@ -13981,73 +13972,43 @@ module_state::set_import (module_state const *other, bool is_export) bitmap_ior_into (slurp ()->headers, other->slurp ()->headers); } -/* Return the decl that determines the owning module of DECL. That - may be DECL itself, or it may DECL's context, or it may be some - other DECL (for instance an unscoped enum's CONST_DECLs are owned - by the TYPE_DECL). It might not be an outermost namespace-scope - decl. */ - +/* Return the namespace-scope decl that determines the owning module + of DECL. That may be DECL itself, or it may DECL's context, or it + may be some other DECL (for instance an unscoped enum's CONST_DECLs + are owned by the TYPE_DECL). */ +// FIXME: May need a variant that gets the owning module of a specialization tree get_module_owner (tree decl) { - again: - gcc_assert (DECL_P (decl)); + gcc_checking_assert (TREE_CODE (decl) != NAMESPACE_DECL); - switch (TREE_CODE (decl)) + for (tree ctx;; decl = ctx) { - case TEMPLATE_DECL: - /* Although a template-decl has ownership, that's mainly for - namespace-scope name pushing. Whether it has one depends on - the thing it's templating, so look at that directly. */ - decl = DECL_TEMPLATE_RESULT (decl); - goto again; - - case NAMESPACE_DECL: - case FUNCTION_DECL: - /* Things that are containers hold their own module owner - info. */ - return decl; - - case TYPE_DECL: - /* The implicit typedef of a tagged type has its own module - owner. */ - if (DECL_IMPLICIT_TYPEDEF_P (decl)) - return decl; - /* Fallthrough. */ - - case VAR_DECL: - /* Things at namespace scope, have their own module owner ... */ - if (TREE_CODE (CP_DECL_CONTEXT (decl)) == NAMESPACE_DECL) - return decl; - break; - - case CONST_DECL: - /* ... except enumeration constants. */ - if (TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE - && DECL_CONTEXT (decl) == DECL_CONTEXT (TYPE_NAME (TREE_TYPE (decl)))) - /* An enumeration is controlled by its enum-decl. Its - enumerations may not have that as DECL_CONTEXT. */ - return TYPE_NAME (TREE_TYPE (decl)); - break; - - default: - break; + ctx = CP_DECL_CONTEXT (decl); + if (TREE_CODE (ctx) == NAMESPACE_DECL) + break; + if (TYPE_P (ctx)) + { + if (tree tn = TYPE_STUB_DECL (ctx)) + ctx = tn; + else + /* Always return something, global_namespace is a useful + non-owning decl. */ + return global_namespace; + } } - /* Otherwise, find this decl's context, which should itself have - the data. */ - tree ctx = CP_DECL_CONTEXT (decl); - gcc_assert (ctx && TREE_CODE (decl) != NAMESPACE_DECL); - if (TYPE_P (ctx)) - { - if (tree tn = TYPE_NAME (ctx)) - ctx = tn; - else - /* Always return something, global_namespace is a useful - non-owning decl. */ - ctx = global_namespace; - } - return ctx; + decl = STRIP_TEMPLATE (decl); + + /* An enumeration is controlled by its enum-decl. Its + enumerations may not have that as DECL_CONTEXT. */ + if (TREE_CODE (decl) == CONST_DECL + && TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE + /* + && DECL_CONTEXT (decl) == DECL_CONTEXT (TYPE_NAME (TREE_TYPE (decl)))*/) + decl = TYPE_NAME (TREE_TYPE (decl)); + + return decl; } /* Is it permissible to redeclare an entity with owner FROM. */ @@ -14064,18 +14025,19 @@ module_may_redeclare (unsigned from) return (*modules)[from]->is_primary (); } -/* Set the module EXPORT and OWNER fields on DECL. */ +/* Set the module EXPORT and OWNER fields on DECL. Only + namespace-scope entites get this. */ void set_module_owner (tree decl) { - /* We should only be setting moduleness on things that are their own - owners. */ - gcc_checking_assert (STRIP_TEMPLATE (decl) == get_module_owner (decl)); - - if (!modules) - /* We can be called when modules are not enabled. */ + if (!modules_p ()) return; + + if (!DECL_NAMESPACE_SCOPE_P (decl)) + return; + + gcc_checking_assert (STRIP_TEMPLATE (decl) == get_module_owner (decl)); // FIXME: Check ill-formed linkage @@ -14098,9 +14060,9 @@ set_module_owner (tree decl) void set_implicit_module_owner (tree decl, tree from) { - gcc_checking_assert (decl == get_module_owner (decl)); - - if (!modules) + if (!modules_p ()) + return; + if (!DECL_NAMESPACE_SCOPE_P (decl)) return; if (unsigned owner = MAYBE_DECL_MODULE_OWNER (from)) diff --git a/gcc/testsuite/g++.dg/modules/by-name-1.C b/gcc/testsuite/g++.dg/modules/by-name-1.C index 82c7794c33f6..1460895be714 100644 --- a/gcc/testsuite/g++.dg/modules/by-name-1.C +++ b/gcc/testsuite/g++.dg/modules/by-name-1.C @@ -11,5 +11,5 @@ class X export X *f (); -// { dg-final { scan-lang-dump {Wrote named decl:-[0-9]* type_decl:'::X'} "module" } } -// { dg-final { scan-lang-dump {Wrote decl's type:-[0-9]* record_type:'::X'} "module" } } +// { dg-final { scan-lang-dump {Wrote named decl:-[0-9]* type_decl:'::X@\(frob\)'} "module" } } +// { dg-final { scan-lang-dump {Wrote decl's type:-[0-9]* record_type:'::X@\(frob\)'} "module" } } diff --git a/gcc/testsuite/g++.dg/modules/class-3_b.C b/gcc/testsuite/g++.dg/modules/class-3_b.C index a661474fd71e..9387bc8e4296 100644 --- a/gcc/testsuite/g++.dg/modules/class-3_b.C +++ b/gcc/testsuite/g++.dg/modules/class-3_b.C @@ -8,8 +8,8 @@ export inline void Frob (X &q) q.b = q.a; } -// { dg-final { scan-lang-dump "Writing interstitial named type type_decl:'::X'" module } } -// { dg-final { scan-lang-dump "Wrote import:-\[0-9\]* type_decl:'::X'@One" module } } -// { dg-final { scan-lang-dump "Wrote decl's type:-\[0-9\]* record_type:'::X'" module } } -// { dg-final { scan-lang-dump "Wrote import:-\[0-9\]* field_decl:'::X::a'@One" module } } -// { dg-final { scan-lang-dump "Wrote import:-\[0-9\]* field_decl:'::X::b'@One" module } } +// { dg-final { scan-lang-dump {Writing interstitial named type type_decl:'::X@\(One\)'} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* type_decl:'::X@\(One\)'@One} module } } +// { dg-final { scan-lang-dump {Wrote decl's type:-[0-9]* record_type:'::X@\(One\)'} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* field_decl:'::X@\(One\)::a'@One} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* field_decl:'::X@\(One\)::b'@One} module } } diff --git a/gcc/testsuite/g++.dg/modules/class-3_d.C b/gcc/testsuite/g++.dg/modules/class-3_d.C index 925518045d59..47ea9b095123 100644 --- a/gcc/testsuite/g++.dg/modules/class-3_d.C +++ b/gcc/testsuite/g++.dg/modules/class-3_d.C @@ -19,8 +19,8 @@ int main () return 0; } -// { dg-final { scan-lang-dump "Imported:-\[0-9\]* type_decl:'::X'@One" module } } -// { dg-final { scan-lang-dump "Read imported type:-\[0-9\]* record_type:'::X'" module } } -// { dg-final { scan-lang-dump "Read named type type_decl:'::X'" module } } -// { dg-final { scan-lang-dump "Imported:-\[0-9\]* field_decl:'::X::a'@One" module } } -// { dg-final { scan-lang-dump "Imported:-\[0-9\]* field_decl:'::X::b'@One" module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* type_decl:'::X@\(One\)'@One} module } } +// { dg-final { scan-lang-dump {Read imported type:-[0-9]* record_type:'::X@\(One\)'} module } } +// { dg-final { scan-lang-dump {Read named type type_decl:'::X@\(One\)'} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* field_decl:'::X@\(One\)::a'@One} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* field_decl:'::X@\(One\)::b'@One} module } } diff --git a/gcc/testsuite/g++.dg/modules/enum-1_a.C b/gcc/testsuite/g++.dg/modules/enum-1_a.C index e8fdbd2676b8..607c31d6dcea 100644 --- a/gcc/testsuite/g++.dg/modules/enum-1_a.C +++ b/gcc/testsuite/g++.dg/modules/enum-1_a.C @@ -27,4 +27,4 @@ export inline Ben func2 () return Ben (4); } -// { dg-final { scan-lang-dump {Written enum value '::Ben'\[2\]} module } } +// { dg-final { scan-lang-dump {Written enum value '::Ben@\(enUm\)'\[2\]} module } } diff --git a/gcc/testsuite/g++.dg/modules/global-2_a.C b/gcc/testsuite/g++.dg/modules/global-2_a.C index 34cb68d07ce2..6906545329a7 100644 --- a/gcc/testsuite/g++.dg/modules/global-2_a.C +++ b/gcc/testsuite/g++.dg/modules/global-2_a.C @@ -16,7 +16,7 @@ export void Log (char const *fmt, ...) va_end (args); } -// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } } +// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log@\(logger\)'} module } } // not reachable (body not inline) // { dg-final { scan-lang-dump-not {Reachable GMF '::printf' added} module } } diff --git a/gcc/testsuite/g++.dg/modules/global-3_a.C b/gcc/testsuite/g++.dg/modules/global-3_a.C index 4c1657a3018c..56c900c5e210 100644 --- a/gcc/testsuite/g++.dg/modules/global-3_a.C +++ b/gcc/testsuite/g++.dg/modules/global-3_a.C @@ -10,7 +10,7 @@ export void Log (char const *msg) std::cout << "Logging:" << msg << "\n"; } -// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } } +// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log@\(logger\)'} module } } // not reachable (body not inline) // { dg-final { scan-lang-dump-not {Reachable GMF '::printf' added} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-1_b.C b/gcc/testsuite/g++.dg/modules/indirect-1_b.C index a7d5668e6692..0fa4faef8287 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-1_b.C +++ b/gcc/testsuite/g++.dg/modules/indirect-1_b.C @@ -35,20 +35,20 @@ namespace bar // { dg-final { scan-lang-dump {Lazily binding '::foo::frob'@'foo' section:} module } } // { dg-final { scan-lang-dump {Wrote public namespace:-[0-9]* namespace_decl:'::foo'@\(none\)} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* function_decl:'::foo::frob'@foo} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* function_decl:'::foo::frob@\(foo\)'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::X'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* type_decl:'::foo::X'@foo} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* type_decl:'::foo::X@\(foo\)'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::Y'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* type_decl:'::foo::Y'@foo} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* type_decl:'::foo::Y@\(foo\)'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::B'@'foo' section:} module } } -// { dg-final { scan-lang-dump-not {Lazily binding '::foo::C'@'foo' section:} module } } +// { dg-final { scan-lang-dump-not {Lazily binding '::foo::C@\(foo\)'@'foo' section:} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::Scoped'@'foo' section:} module } } -// { dg-final { scan-lang-dump-not {Lazily binding '::foo::Scoped::[ABCD]'@'foo' section:} module } } +// { dg-final { scan-lang-dump-not {Lazily binding '::foo::Scoped@\(foo\)::[ABCD]'@'foo' section:} module } } -// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Plain::C'@foo} module } } -// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Plain::B'@foo} module } } -// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Scoped::C'@foo} module } } -// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Scoped::B'@foo} module } } +// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Plain@\(foo\)::C'@foo} module } } +// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Plain@\(foo\)::B'@foo} module } } +// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Scoped@\(foo\)::C'@foo} module } } +// { dg_final { scan-lang-dump {Wrote named import:-[0-9]* const_decl:'::foo::Scoped@\(foo\)::B'@foo} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-1_c.C b/gcc/testsuite/g++.dg/modules/indirect-1_c.C index 1925638b638e..d23e54e04629 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-1_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-1_c.C @@ -26,25 +26,25 @@ int main () // { dg-final { scan-lang-dump {Lazily binding '::bar::frob'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::frob'@'foo' section:} module } } // { dg-final { scan-lang-dump {Namespace:-[0-9]* namespace_decl:'::foo'@.none.} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::frob'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::frob@\(foo\)'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::quux'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::X'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* type_decl:'::foo::X'@foo} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::X::__ct_comp '@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* type_decl:'::foo::X@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::X@\(foo\)::__ct_comp '@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::Z'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::Y'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* type_decl:'::foo::Y'@foo} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* field_decl:'::foo::Y::_vptr.Y'@foo} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::Y::frob'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* type_decl:'::foo::Y@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* field_decl:'::foo::Y@\(foo\)::_vptr.Y'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::Y@\(foo\)::frob'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::Plain_One'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::Plain'@'foo' section} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::Scoped_One'@'bar' section} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::Scoped'@'foo' section:} module } } // { dg-final { scan-lang-dump-not {Lazily binding '::foo::[ABC]'@'foo' section:} module } } -// { dg-final { scan-lang-dump-not {Lazily binding '::foo::Scoped::[ABC]'@'foo' section:} module } } +// { dg-final { scan-lang-dump-not {Lazily binding '::foo::Scoped@\(foo\)::[ABC]'@'foo' section:} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::Plain_Const_Three'@'bar' section:} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::Scoped_Const_Three'@'bar' section} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-2_b.C b/gcc/testsuite/g++.dg/modules/indirect-2_b.C index a422571a4289..e86570c7ffad 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-2_b.C +++ b/gcc/testsuite/g++.dg/modules/indirect-2_b.C @@ -18,10 +18,10 @@ namespace bar } // { dg-final { scan-lang-dump {Lazily binding '::foo::frob'@'foo' section} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::frob'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::frob<0x0>'@} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::frob@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::frob@\(foo\)<0x0>'@} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::X'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::X'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::X<0x0>'@} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::X@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::X@\(foo\)<0x0>'@} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-2_c.C b/gcc/testsuite/g++.dg/modules/indirect-2_c.C index 38e66cd8707a..e0e415970631 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-2_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-2_c.C @@ -15,11 +15,11 @@ int main () // { dg-final { scan-lang-dump {Lazily binding '::bar::frob'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::frob'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::frob'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::frob<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::frob@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::frob@\(foo\)<0x0>'@foo} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::quux'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::X'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::X'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::X<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::X@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::X@\(foo\)<0x0>'@foo} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-3_b.C b/gcc/testsuite/g++.dg/modules/indirect-3_b.C index fb7bf261d50f..2bb45a41abeb 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-3_b.C +++ b/gcc/testsuite/g++.dg/modules/indirect-3_b.C @@ -18,10 +18,10 @@ namespace bar } // { dg-final { scan-lang-dump {Lazily binding '::foo::X'@'foo' section} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::X::frob'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::X::frob<0x0>'@} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::X@\(foo\)::frob'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::X@\(foo\)::frob<0x0>'@} module } } // { dg-final { scan-lang-dump {Lazily binding '::foo::TPL'@'foo' section} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::TPL<0x0>'@} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* function_decl:'::foo::TPL<0x0>::frob<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::TPL@\(foo\)<0x0>'@} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* function_decl:'::foo::TPL@\(foo\)<0x0>::frob<0x0>'@foo} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-3_c.C b/gcc/testsuite/g++.dg/modules/indirect-3_c.C index d5e86a68714c..bbb969b4d787 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-3_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-3_c.C @@ -15,12 +15,12 @@ int main () // { dg-final { scan-lang-dump {Lazily binding '::bar::quux'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::X'@'foo' section} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::X::frob'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::X::frob<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::X@\(foo\)::frob'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::X@\(foo\)::frob<0x0>'} module } } // { dg-final { scan-lang-dump {Lazily binding '::bar::toto'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::TPL'@'foo' section} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL'@foo} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::TPL<0x0>::frob<0x0>'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::TPL<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* function_decl:'::foo::TPL@\(foo\)<0x0>::frob<0x0>'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::TPL@\(foo\)<0x0>'@foo} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-4_b.C b/gcc/testsuite/g++.dg/modules/indirect-4_b.C index d3c52d95ad3f..e8ca2b2fe26d 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-4_b.C +++ b/gcc/testsuite/g++.dg/modules/indirect-4_b.C @@ -13,7 +13,7 @@ namespace bar } // { dg-final { scan-lang-dump {Lazily binding '::foo::TPL'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::TPL<0x1>'@} module } } -// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL<0x1>::frob<#unnamed#>'@foo} module } } -// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::TPL<0x1>::frob<0x2>'@} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* type_decl:'::foo::TPL@\(foo\)<0x1>'@\(none\)} module } } +// { dg-final { scan-lang-dump {Wrote import:-[0-9]* template_decl:'::foo::TPL@\(foo\)<0x1>::frob<#unnamed#>'@foo} module } } +// { dg-final { scan-lang-dump {Wrote instantiation:-[0-9]* function_decl:'::foo::TPL@\(foo\)<0x1>::frob<0x2>'@\(none\)} module } } diff --git a/gcc/testsuite/g++.dg/modules/indirect-4_c.C b/gcc/testsuite/g++.dg/modules/indirect-4_c.C index 5e04641a4ea7..f253d5f1ad97 100644 --- a/gcc/testsuite/g++.dg/modules/indirect-4_c.C +++ b/gcc/testsuite/g++.dg/modules/indirect-4_c.C @@ -11,7 +11,7 @@ int main () // { dg-final { scan-lang-dump {Lazily binding '::bar::quux'@'bar' section:} module } } // { dg-final { scan-lang-dump {>Lazily binding '::foo::TPL'@'foo' section:} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL'@foo} module } } -// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL<0x1>::frob<#unnamed#>'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::TPL<0x1>'@foo} module } } -// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::TPL<0x1>::frob<0x2>'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL@\(foo\)'@foo} module } } +// { dg-final { scan-lang-dump {Imported:-[0-9]* template_decl:'::foo::TPL@\(foo\)<0x1>::frob<#unnamed#>'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* type_decl:'::foo::TPL@\(foo\)<0x1>'@foo} module } } +// { dg-final { scan-lang-dump {Instantiation:-[0-9]* function_decl:'::foo::TPL@\(foo\)<0x1>::frob<0x2>'@\(detached\)} module } } diff --git a/gcc/testsuite/g++.dg/modules/part-3_c.C b/gcc/testsuite/g++.dg/modules/part-3_c.C index c47244e2f77a..a4149d3ee552 100644 --- a/gcc/testsuite/g++.dg/modules/part-3_c.C +++ b/gcc/testsuite/g++.dg/modules/part-3_c.C @@ -12,6 +12,6 @@ export inline int frob (int x) } // { dg-final { scan-lang-dump {Read:-[0-9] new mergeable decl function_decl:'::foo'} module } } -// { dg-final { scan-lang-dump {Read:-[0-9] matched mergeable decl function_decl:'::foo'} module } } -// { dg-final { scan-lang-dump {Recording new skippable function_decl:'::foo'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9] matched mergeable decl function_decl:'::foo@\(:bar\)'} module } } +// { dg-final { scan-lang-dump {Recording new skippable function_decl:'::foo@\(:bar\)'} module } } // { dg-final { scan-lang-dump {Declaration sections are \[1,3\)} module } } diff --git a/gcc/testsuite/g++.dg/modules/scc-1.C b/gcc/testsuite/g++.dg/modules/scc-1.C index 6f65050f7d12..14f51fceea60 100644 --- a/gcc/testsuite/g++.dg/modules/scc-1.C +++ b/gcc/testsuite/g++.dg/modules/scc-1.C @@ -10,7 +10,7 @@ export int bar (int = baz (1)); // The ordering depends on hash table iteration, which is address-dependent -// { dg-final { scan-lang-dump { Writing:-[0-9] function_decl:'::ba[rz]' .exported.} "module" } } -// { dg-final { scan-lang-dump { Writing:-[0-9]* function_decl:'::ba[rz]' .exported.} "module" } } -// { dg-final { scan-lang-dump { *\.\.* Wrote backref:-[0-9] function_decl:'::ba[rz]'} "module" } } -// { dg-final { scan-lang-dump { Wrote backref:-[0-9]* function_decl:'::ba[rz]'} "module" } } +// { dg-final { scan-lang-dump { Writing:-[0-9] function_decl:'::bar@\(foo\)' .exported.} "module" } } +// { dg-final { scan-lang-dump { Writing:-[0-9]* function_decl:'::baz@\(foo\)' .exported.} "module" } } +// { dg-final { scan-lang-dump { *\.\.* Wrote backref:-[0-9] function_decl:'::ba[rz]@\(foo\)'} "module" } } +// { dg-final { scan-lang-dump { Wrote backref:-[0-9]* function_decl:'::ba[rz]@\(foo\)'} "module" } } diff --git a/gcc/testsuite/g++.dg/modules/stdio-1_a.H b/gcc/testsuite/g++.dg/modules/stdio-1_a.H index daa78e239c68..e8839e0c7e7a 100644 --- a/gcc/testsuite/g++.dg/modules/stdio-1_a.H +++ b/gcc/testsuite/g++.dg/modules/stdio-1_a.H @@ -10,6 +10,6 @@ #endif // There should be *lots* of depsets (209 for glibc today) // { dg-final { scan-lang-dump {Writing SCC:60 } module } } -// { dg-final { scan-lang-dump {Depset:0 decl function_decl:'::printf'} module } } +// { dg-final { scan-lang-dump {Depset:0 decl function_decl:'::printf@\([^\n]*stdio-1_a.H\)'} module } } // { dg-final { scan-lang-dump {Depset:1 binding namespace_decl:'::printf'} module } } // { dg-final { scan-lang-dump {Controlling macro=_PROXY_STDIO_H} module } } diff --git a/gcc/testsuite/g++.dg/modules/using-4_a.C b/gcc/testsuite/g++.dg/modules/using-4_a.C index acf7c6467152..07517eb8cdda 100644 --- a/gcc/testsuite/g++.dg/modules/using-4_a.C +++ b/gcc/testsuite/g++.dg/modules/using-4_a.C @@ -12,6 +12,6 @@ using N::foo; export using N::foo; // { dg-final { scan-lang-dump {Writing SCC:2 2 depsets} module } } -// { dg-final { scan-lang-dump {Depset:0 using overload:'::N::foo'} module } } +// { dg-final { scan-lang-dump {Depset:0 using overload:'::N::foo@\(bob\)'} module } } // { dg-final { scan-lang-dump {Depset:1 binding namespace_decl:'::foo'} module } } diff --git a/gcc/testsuite/g++.dg/modules/vmort-2_a.C b/gcc/testsuite/g++.dg/modules/vmort-2_a.C index f58ec9548bfe..a58b72565cd3 100644 --- a/gcc/testsuite/g++.dg/modules/vmort-2_a.C +++ b/gcc/testsuite/g++.dg/modules/vmort-2_a.C @@ -9,6 +9,6 @@ export auto frobber (int i) return [=] (int j) { return i + j; }; } -// { dg-final { scan-lang-dump {Voldemort:0 '::frobber::._0'} module } } -// { dg-final { scan-lang-dump {Connecting definition unnamed type_decl:'::frobber::._0'} module } } -// { dg-final { scan-lang-dump {Unnamed 0 '::frobber::._0' section:1} module } } +// { dg-final { scan-lang-dump {Voldemort:0 '::frobber@\(voldy\)::._0'} module } } +// { dg-final { scan-lang-dump {Connecting definition unnamed type_decl:'::frobber@\(voldy\)::._0'} module } } +// { dg-final { scan-lang-dump {Unnamed 0 '::frobber@\(voldy\)::._0' section:1} module } } diff --git a/gcc/testsuite/g++.dg/modules/vmort-2_b.C b/gcc/testsuite/g++.dg/modules/vmort-2_b.C index 635c1b0e94fb..d1645cf8167d 100644 --- a/gcc/testsuite/g++.dg/modules/vmort-2_b.C +++ b/gcc/testsuite/g++.dg/modules/vmort-2_b.C @@ -10,7 +10,7 @@ export auto conduit (int i) return frobber (i); } -// { dg-final { scan-lang-dump {Voldemort decl:0 \[0\] '::frobber::._0'} module } } -// { dg-final { scan-lang-dump {Cluster imported entity '::frobber::._0'} module } } -// { dg-final { scan-lang-dump {Inserted:-1 horcrux:0@2 for '::frobber::._0'} module } } +// { dg-final { scan-lang-dump {Voldemort decl:0 \[0\] '::frobber@\(voldy\)::._0'} module } } +// { dg-final { scan-lang-dump {Cluster imported entity '::frobber@\(voldy\)::._0'} module } } +// { dg-final { scan-lang-dump {Inserted:-1 horcrux:0@2 for '::frobber@\(voldy\)::._0'} module } } diff --git a/gcc/testsuite/g++.dg/modules/vmort-2_c.C b/gcc/testsuite/g++.dg/modules/vmort-2_c.C index 1ce0147c64d4..2160c64fa1b8 100644 --- a/gcc/testsuite/g++.dg/modules/vmort-2_c.C +++ b/gcc/testsuite/g++.dg/modules/vmort-2_c.C @@ -10,4 +10,4 @@ int main () } // { dg-final { scan-lang-dump {Lazily binding '#null##null#'@'voldy' section:1} module } } -// { dg-final { scan-lang-dump {Inserted:-1 horcrux:0@2 '::frobber::._0'} module } } +// { dg-final { scan-lang-dump {Inserted:-1 horcrux:0@2 '::frobber@\(voldy\)::._0'} module } }