[clang] [Clang] Consider reachability for file-scope warnings on initializers (PR #163885)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 19 00:26:12 PDT 2025


================
@@ -57,6 +61,8 @@ class AnalysisBasedWarnings {
 
   enum VisitFlag { NotVisited = 0, Visited = 1, Pending = 2 };
   llvm::DenseMap<const FunctionDecl*, VisitFlag> VisitedFD;
+  llvm::MapVector<VarDecl *, SmallVector<PossiblyUnreachableDiag, 4>>
+      VarDeclPossiblyUnreachableDiags;
----------------
cor3ntin wrote:

I feel like a `std::multimap<VarDecl *,  PossiblyUnreachableDiag>` would be a more suited container here

(still preserve order and avoid having lots of SmallVector)

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


More information about the cfe-commits mailing list