[clang] [Clang] Consider reachability for file-scope warnings on initializers (PR #163885)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 20 12:15:47 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;
----------------
JustinStitt wrote:
Hi, this is done in [`c6ec954` (#163885)](https://github.com/llvm/llvm-project/pull/163885/commits/c6ec954bf777b812848774baf61f0e74a922d1d1) but I think it wasn't as elegant as I was expecting. This is because `SmallVector<PossiblyUnreachableDiag, 4> PossiblyUnreachableDiags;` in `ScopeInfo.h` which meant I needed to template `emitPossiblyUnreachableDiags` and use `llvm::make_second_range`.
https://github.com/llvm/llvm-project/pull/163885
More information about the cfe-commits
mailing list