This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DWARF question/inlining/local classes
- From: Geoff Keating <geoffk at geoffk dot org>
- To: mark at codesourcery dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 31 Oct 2002 11:00:25 -0800
- Subject: Re: DWARF question/inlining/local classes
- References: <26310000.1036029185@warlock.codesourcery.com>
> Date: Wed, 30 Oct 2002 17:53:05 -0800
> From: Mark Mitchell <mark@codesourcery.com>
> --On Wednesday, October 30, 2002 04:44:12 PM -0800 Geoff Keating
> <geoffk@geoffk.org> wrote:
>
> > Mark Mitchell <mark@codesourcery.com> writes:
> >
> >> PR 8391 contains this code:
> >>
> >> inline void h(const Outer &o)
> >> {
> >> struct Local : public Outer::Inner {
> >> virtual bool f() {};
> >> };
> >> Local l;
> >> o.g(l);
> >> }
> >>
> >> When we try to emit the body of Local::f (the function in the struct
> >> inside h), we don't actually emit assembly code because of this code
> >> in rest_of_compilation:
> >>
> >> /* If this is nested inside an inlined external function, pretend
> >> it was only declared. Since we cannot inline such functions,
> >> generating code for this one is not only not necessary but will
> >> confuse some debugging output writers. */
> >> for (parent = DECL_CONTEXT (current_function_decl);
> >> parent != NULL_TREE;
> >> parent = get_containing_scope (parent))
> >> if (TREE_CODE (parent) == FUNCTION_DECL
> >> && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
> >> {
> >> DECL_INITIAL (decl) = 0;
> >> goto exit_rest_of_compilation;
> >> }
> >>
> >> This logic is wrong for C++; we need to emit Local::f.
> >
> > I believe the rationale behind this code is that Local::f can't be
> > used from this translation unit, since the function won't be inlined.
> > It will be emitted when the out-of-line copy of the function is emitted.
> >
> > Will this function really not be inlined?
>
> The function will indeed be inlined in this translation unit.
That's what I thought. I bet this comment dates from the time of the
RTL inliner, which (no doubt) really couldn't inline such functions.
It's possible that this code is obsolete and should go away.
--
- Geoffrey Keating <geoffk@geoffk.org>