================
@@ -454,10 +454,29 @@ bool isPtrConversion(const FunctionDecl *F) {
   return false;
 }
 
-bool isNoDeleteFunction(const FunctionDecl *F) {
+static bool isNoDeleteFunctionDecl(const FunctionDecl *F) {
   return typeAnnotationForReturnType(F) == WebKitAnnotation::NoDelete;
 }
 
+bool isNoDeleteFunction(const FunctionDecl *F) {
+  if (llvm::any_of(F->redecls(), isNoDeleteFunctionDecl))
----------------
steakhal wrote:

What made me think of this was the following:
When would I want to check for the nodelete annotation without walking all of 
the redecls?
If the answer is that in some cases I would want to only check a specific 
declaration - then it makes sense to have an API for inspecting that.
If you always want to check all of its redeclarations, then why have a separate 
API for doing that? Opening up the opportunity for accidentally using that 
while you intended to implicitly check all the redecls.

https://github.com/llvm/llvm-project/pull/183970
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to