(SET_DECL_THUNKS): New.
* decl.c (duplicate_decls): Adjust.
* method.c (make_thunk): Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192368
138bc75d-0d04-0410-961f-
82ee72b054a4
2012-10-11 Jason Merrill <jason@redhat.com>
+ * cp-tree.h (DECL_THUNKS): NULL_TREE for non-virtual functions.
+ (SET_DECL_THUNKS): New.
+ * decl.c (duplicate_decls): Adjust.
+ * method.c (make_thunk): Adjust.
+
* decl.c (grokdeclarator): Set DECL_GNU_TLS_P for static data
members, too.
/* The thunks associated with NODE, a FUNCTION_DECL. */
#define DECL_THUNKS(NODE) \
- (LANG_DECL_FN_CHECK (NODE)->context)
+ (DECL_VIRTUAL_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
+
+/* Set DECL_THUNKS. */
+#define SET_DECL_THUNKS(NODE,THUNKS) \
+ (LANG_DECL_FN_CHECK (NODE)->context = (THUNKS))
/* Nonzero if NODE is a thunk, rather than an ordinary function. */
#define DECL_THUNK_P(NODE) \
/* DECL_THUNKS is only valid for virtual functions,
otherwise it is a DECL_FRIEND_CONTEXT. */
if (DECL_VIRTUAL_P (newdecl))
- DECL_THUNKS (newdecl) = DECL_THUNKS (olddecl);
+ SET_DECL_THUNKS (newdecl, DECL_THUNKS (olddecl));
}
/* Only variables have this field. */
else if (TREE_CODE (newdecl) == VAR_DECL
FUNCTION_DECL, NULL_TREE, TREE_TYPE (function));
DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function);
cxx_dup_lang_specific_decl (thunk);
- DECL_THUNKS (thunk) = NULL_TREE;
+ DECL_VIRTUAL_P (thunk) = true;
+ SET_DECL_THUNKS (thunk, NULL_TREE);
DECL_CONTEXT (thunk) = DECL_CONTEXT (function);
TREE_READONLY (thunk) = TREE_READONLY (function);
/* Add it to the list of thunks associated with FUNCTION. */
DECL_CHAIN (thunk) = DECL_THUNKS (function);
- DECL_THUNKS (function) = thunk;
+ SET_DECL_THUNKS (function, thunk);
return thunk;
}