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

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 07:53:43 PDT 2025


================
@@ -57,10 +61,14 @@ class AnalysisBasedWarnings {
 
   enum VisitFlag { NotVisited = 0, Visited = 1, Pending = 2 };
   llvm::DenseMap<const FunctionDecl*, VisitFlag> VisitedFD;
+  llvm::MapVector<VarDecl *, SmallVector<PossiblyUnreachableDiag, 4>>
+      VarDeclPossiblyUnreachableDiags;
 
   Policy PolicyOverrides;
   void clearOverrides();
 
+  void FlushDiagnostics(SmallVector<clang::sema::PossiblyUnreachableDiag, 4>);
----------------
zwuis wrote:

I know we are _very_ inconsistent about this, but functions should start with a lowercase letter.

---

We can use `const SmallVectorImpl<PossiblyUnreachableDiag> &` as parameter type because we don't care about the number of inline elements.

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


More information about the cfe-commits mailing list