[llvm-branch-commits] [clang] [analyzer][NFC] BugReporterVisitors.h should include MemRegion.h (PR #235283)
Balázs Benics via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Oct 25 10:15:02 PDT 2026
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/235283
>From 0479cde4104d356166d94a6785f5d0ac27d00195 Mon Sep 17 00:00:00 2001
From: Balazs Benics <benicsbalazs at gmail.com>
Date: Sat, 24 Oct 2026 11:24:24 +0100
Subject: [PATCH] [analyzer][NFC] BugReporterVisitors.h should include
MemRegion.h
BugReporterVisitors.h includes RangedConstraintManager.h but uses
nothing it declares: RangeSet, Range, ConstraintMap and
SimpleConstraintManager appear nowhere in the file. What the header
actually needs is MemRegion.h, which supplies SubRegion,
MemRegionManager and MemRegion completeness for an inline constructor;
today those arrive only by accident, transitively through
RangedConstraintManager.h -> ProgramState.h. Swapping the include for
the one that carries the used declarations makes the dependency honest
and adds a forward declaration of CallEvent in namespace clang::ento
for the one name that only needs to be incomplete.
One header needs a compensating include: Z3CrosscheckVisitor.h uses
ConstraintMap and was getting RangedConstraintManager.h through
BugReporterVisitors.h, so it now includes it directly. No translation
unit in clangStaticAnalyzerCore, clangStaticAnalyzerCheckers or
clangStaticAnalyzerFrontend required any other change.
This patch doesn't improve compile time but improves include hygiene.
Authored-By: Claude
---
.../StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h | 3 ++-
.../StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
index 18d299f8bf7e26..9b1da8ce5e8283 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
@@ -16,7 +16,7 @@
#include "clang/Analysis/ProgramPoint.h"
#include "clang/Basic/LLVM.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -40,6 +40,7 @@ namespace ento {
class PathSensitiveBugReport;
class BugReporterContext;
+class CallEvent;
class ExplodedNode;
class MemRegion;
class PathDiagnosticPiece;
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
index 952ee09902dded..60e00a7535dbf5 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_Z3CROSSCHECKVISITOR_H
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
namespace clang::ento {
More information about the llvm-branch-commits
mailing list