[PATCH] D90275: [clang][IR] Add support for leaf attribute

Gulfem Savrun Yeniceri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 10:50:33 PST 2020


gulfem added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:1435
+  let Spellings = [GCC<"leaf">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
----------------
aaron.ballman wrote:
> gulfem wrote:
> > aaron.ballman wrote:
> > > Should this attribute also be supported on things like ObjC method decls or other function-like interfaces?
> > Do I need to do anything else to support this attribute in Objective-C as well?
> > I think we should support it in all the C languages family.
> >I think we should support it in all the C languages family.
> 
> That's already happening automatically -- there's a C and C++ spelling available for it and the attribute doesn't specify that it requires a particular language mode or target.
> 
> > Do I need to do anything else to support this attribute in Objective-C as well?
> You can add multiple subjects to the list here, so you can have this apply to `Function, ObjCMethod` for both of those. Another one to consider is whether this attribute can be written on a block declaration (like a lambda, but with different syntax). Beyond that, it's mostly just documentation, devising the test cases to ensure the ObjC functionality behaves as expected, possibly some codegen changes, etc.
AFAIK, users can specify function attributes in lambda expressions.
Lambda functions can only be accessed/called by the functions in the same translation unit, right?
Leaf attribute does not have any effect on the functions that are defined in the same translation unit.
For this reason, I'm thinking that leaf attribute would not have any effect if they are used in lambda expressions.
Do you agree with me?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90275/new/

https://reviews.llvm.org/D90275



More information about the cfe-commits mailing list