From 6ff7fb95722130e00e6ac16d45b53c3618ea9c7c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 15 Dec 1999 09:37:48 +0000 Subject: tree.c (decl_function_context): Handle virtual functions. * tree.c (decl_function_context): Handle virtual functions. * tlink.c (scan_linker_output): Don't look in demangled name when looking for linker output keywords. * dwarfout.c (output_type): We can defer namespace-scope classes. From-SVN: r30950 --- gcc/tree.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 37a8654..78ea4cf 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4802,6 +4802,15 @@ decl_function_context (decl) if (TREE_CODE (decl) == SAVE_EXPR) context = SAVE_EXPR_CONTEXT (decl); + /* C++ virtual functions use DECL_CONTEXT for the class of the vtable + where we look up the function at runtime. Such functions always take + a first argument of type 'pointer to real context'. + + C++ should really be fixed to use DECL_CONTEXT for the real context, + and use something else for the "virtual context". */ + else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VINDEX (decl)) + context = TYPE_MAIN_VARIANT + (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))))); else context = DECL_CONTEXT (decl); -- cgit v1.1