[clang] [analyzer] Introduce the invalidation artifact symbol (PR #207155)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 23 05:01:31 PDT 2026
================
@@ -0,0 +1,206 @@
+//===- InvalidationCause.h - Cause of a region invalidation ------*- C++ -*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines InvalidationCause, a small class hierarchy describing why
+// a memory region was invalidated by ProgramState::invalidateRegions. The
+// cause is carried by SymbolInvalidationArtifact symbols so that downstream
+// machinery (bug-report suppression, diagnostics) can distinguish symbolic
+// values produced by an invalidation event from ordinary conjured symbols.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_INVALIDATIONCAUSE_H
+#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_INVALIDATIONCAUSE_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Support/Compiler.h"
+
+namespace clang {
+
+class CallExpr;
+class Stmt;
+
+namespace ento {
+
+class SymbolManager;
+
+/// Describes why a memory region was invalidated. Instances are uniqued by
+/// SymbolManager::acquireCause<T>(...) and are stable for the analysis
+/// lifetime; callers must not allocate them on the stack.
+class InvalidationCause : public llvm::FoldingSetNode {
+public:
+ virtual ~InvalidationCause() = default;
+
+ enum Kind {
+ // UnmodeledCall range
+ ConservativeEvalCallKind,
+ PartiallyModeledCallKind,
+ BEGIN_UNMODELED_CALL = ConservativeEvalCallKind,
+ END_UNMODELED_CALL = PartiallyModeledCallKind,
+
+ // UnmodeledStmt range
----------------
steakhal wrote:
I'll keep this in mind and revisit this when applicable.
https://github.com/llvm/llvm-project/pull/207155
More information about the cfe-commits
mailing list