diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-12-04 17:11:05 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-12-04 17:11:05 +0000 |
commit | be1bb2a4da1988e257996be479d8cd62a91358fc (patch) | |
tree | 6455b9956b6bf8c80205881f80ee6d34faaa2117 /gcc | |
parent | 0839863cfad677645b112db8c6bdc4153768412d (diff) | |
download | gcc-be1bb2a4da1988e257996be479d8cd62a91358fc.zip gcc-be1bb2a4da1988e257996be479d8cd62a91358fc.tar.gz gcc-be1bb2a4da1988e257996be479d8cd62a91358fc.tar.bz2 |
tree.c (get_callee_fndecl): Only use DECL_ABSTRACT_ORIGIN if it has DECL_SAVED_TREE.
* tree.c (get_callee_fndecl): Only use DECL_ABSTRACT_ORIGIN if
it has DECL_SAVED_TREE.
From-SVN: r47615
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/tree.c | 21 |
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ee8290..5722811 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2001-12-04 Alexandre Oliva <aoliva@redhat.com> + * tree.c (get_callee_fndecl): Only use DECL_ABSTRACT_ORIGIN if + it has DECL_SAVED_TREE. + * c-decl.c (duplicate_decls): Revert rth's patch. If newdecl is in a different binding level, get its abstract origin to be olddecl. @@ -4379,12 +4379,21 @@ get_callee_fndecl (call) if (TREE_CODE (addr) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL) { - addr = TREE_OPERAND (addr, 0); - - if (! DECL_INITIAL (addr) && DECL_ABSTRACT_ORIGIN (addr)) - addr = DECL_ABSTRACT_ORIGIN (addr); - - return addr; + tree fn = TREE_OPERAND (addr, 0); + + /* If fn is a declaration of a function in a nested scope that + was globally declared inline, we don't set its DECL_INITIAL. + However, we can't blindly follow DECL_ABSTRACT_ORIGIN because + the C++ front-end uses it for cdtors to refer to their + internal declarations, that are not real functions. + Fortunately those don't have trees to be saved, so we can tell by + checking their DECL_SAVED_TREE. */ + if (! DECL_INITIAL (fn) + && DECL_ABSTRACT_ORIGIN (fn) + && DECL_SAVED_TREE (DECL_ABSTRACT_ORIGIN (fn))) + fn = DECL_ABSTRACT_ORIGIN (fn); + + return fn; } /* We couldn't figure out what was being called. */ |