[clang] [alpha.webkit.NoDeleteChecker] Don't emit a warning for a function without annotation. (PR #178824)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 30 03:21:48 PST 2026


================

----------------
steakhal wrote:

BTW why do we walk the base classes and all this?
Should this alternative implementation be simpler?
```c++
  static bool hasNoDeleteAnnotation(const FunctionDecl *FD) {
    if (llvm::any_of(FD->redecls(), isNoDeleteFunction))
      return true;

    const auto *MD = dyn_cast<CXXMethodDecl>(FD);
    if (!MD && !MD->isVirtual())
      return false;

    auto Overriders = llvm::to_vector(MD->overridden_methods());
    while (!Overriders.empty()) {
      const auto *CurrFn = Overriders.pop_back_val();
      llvm::append_range(Overriders, CurrFn->overridden_methods());
      if (isNoDeleteFunction(CurrFn)) {
        return true;
      }
    }
    return false;
  }
```

https://github.com/llvm/llvm-project/pull/178824


More information about the cfe-commits mailing list