From f3665bd1111c1799c0421490b5e655f977570354 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 28 Jul 2020 08:57:36 -0700 Subject: c++: Set more DECL_CONTEXTs I discovered we were not setting DECL_CONTEXT in a few cases, and grokfndecl's control flow wasn't making it clear that we were doing it in all cases. gcc/cp/ * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context. * cp-objcp-common.c (cp_pushdecl): Set decl's context. * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer. --- gcc/cp/cp-objcp-common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/cp/cp-objcp-common.c') diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index dfd8be9..fecf866 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -332,11 +332,12 @@ cp_get_global_decls () return NAMESPACE_LEVEL (global_namespace)->names; } -/* Push DECL into the current scope. */ +/* Push DECL into the current (namespace) scope. */ tree cp_pushdecl (tree decl) { + DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); return pushdecl (decl); } -- cgit v1.1