[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:44 PDT 2025


================
@@ -6750,6 +6750,11 @@ class Sema final : public SemaBase {
     /// suffice, e.g., in a default function argument.
     Decl *ManglingContextDecl;
 
+    /// Declaration for initializer if one is currently being
+    /// parsed. Used when an expression has a possibly unreachable
+    /// diagnostic to reference the declaration as a whole.
+    Decl *DeclForInitializer = nullptr;
----------------
zwuis wrote:

How about `VarDecl *`?

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


More information about the cfe-commits mailing list