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

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 22:10:09 PST 2015


ahatanak added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:5374
@@ +5373,3 @@
+
+  // Virtual functions cannot be marked as 'notail'.
+  if (auto *Attr = ND.getAttr<NotTailCalledAttr>())
----------------
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.


http://reviews.llvm.org/D12922





More information about the cfe-commits mailing list