[PATCH] Implement the flatten attribute.

Peter Collingbourne peter at pcc.me.uk
Tue May 20 10:20:53 PDT 2014


On Tue, May 20, 2014 at 09:02:12AM -0400, Aaron Ballman wrote:
> > Index: include/clang/Basic/AttrDocs.td
> > ===================================================================
> > --- include/clang/Basic/AttrDocs.td
> > +++ include/clang/Basic/AttrDocs.td
> > @@ -868,6 +868,14 @@
> >    }];
> >  }
> >
> > +def FlattenDocs : Documentation {
> > +  let Category = DocCatFunction;
> > +  let Content = [{
> > +The ``flatten`` attribute causes functions called by the function with the
> > +attribute to be inlined if possible.
> 
> Aren't functions already inlined if possible, regardless of this
> attribute?

As far as I know, the inliner uses a cost model to decide whether to inline
a function, and the alwaysinline attribute overrides the cost model.

> Also, it may be a bit more clear to say "calls within the
> attributed function" instead of "functions called by the function."

Done.

> Other than that, LGTM!

Thanks, r209217.

-- 
Peter



More information about the cfe-commits mailing list