[clang] [alpha.webkit.NoDeleteChecker] Blame the code that is actually unsafe (PR #224728)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 5 10:59:00 PDT 2026
================
@@ -863,11 +867,41 @@ class TrivialFunctionAnalysisVisitor
}
bool IsFunctionTrivial(const Decl *D) {
- // Blame stays within the function being analyzed: a statement in a callee
- // is not a useful location for the primary diagnostic. The root cause is
- // tracked separately and does cross function boundaries.
- const Stmt **SavedOffendingStmt = std::exchange(OffendingStmt, nullptr);
- auto Result = WithCachedResult(D, [&]() {
+ if (!CallStack)
+ return IsFunctionTrivialImpl(D);
+
+ const auto *FnDecl = dyn_cast<FunctionDecl>(D);
+ if (!FnDecl)
+ return IsFunctionTrivialImpl(D);
+
+ // CallStack[0, ActiveDepth) mirrors the functions currently being
+ // analyzed. Anything past that was left by a callee whose failure was
+ // tolerated, e.g. one of several candidate default constructors, and is
+ // not part of the chain that explains this call.
+ CallStack->truncate(ActiveDepth);
+ size_t Index = ActiveDepth++;
+ CallStack->push_back({FnDecl, nullptr});
----------------
steakhal wrote:
I was expecting this line at some `Traverse*` (like `TraverseCallExpr`) function, hooking how we dispatch to a callee - but I suppose I didn't quite grasp the existing architecture.
https://github.com/llvm/llvm-project/pull/224728
More information about the cfe-commits
mailing list