[PATCH] D12922: Add support for function attribute "notail"

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 09:17:00 PST 2015


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


================
Comment at: lib/Sema/SemaDecl.cpp:5374
@@ +5373,3 @@
+
+  // Virtual functions cannot be marked as 'notail'.
+  if (auto *Attr = ND.getAttr<NotTailCalledAttr>())
----------------
ahatanak wrote:
> aaron.ballman wrote:
> > I am not home yet, and so I don't have the source code to try this out, but I have a sneaking suspicion there's a way to tell whether a function is an override. IIRC, it's something like overridden_methods() on a CXXMethodDecl.
> > 
> > I will do some poking when I am back in front of the source. Otherwise, I would guess you can look at some of the diagnostics in DiagnosticSemaKinds.td for the override keyword itself, because I bet we warn when you specify override on something that isn't a virtual function override, and that should have a code example.
> It's possible to tell a method is a virtual function if either an overridden method is added to its declaration (which will cause isVirtual() to return true) or an OverrideAttr attribute is added. Currently, processDeclAttributes is called before these methods or attributes are added, and that is why I think it isn't possible to tell if the method is virtual when the attributes are being checked.
Ugh, that is really unfortunate, but I think you're right. At some point, we may have to find a way to handle this, but I don't think that should hold up your patch.


http://reviews.llvm.org/D12922





More information about the cfe-commits mailing list