[clang] [Clang] Initialize bypassed variables w/ trivial-auto-var-init (PR #181937)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 23:23:14 PDT 2026


================
@@ -1749,6 +1757,8 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S,
   // switch machinery to enter this block.
   llvm::BasicBlock *CaseDest = createBasicBlock("sw.bb");
   EmitBlockWithFallThrough(CaseDest, &S);
+  if (getLangOpts().CPlusPlus)
----------------
ojhunt wrote:

I think computed goto is a sufficiently complex problem on its own, and is fundamentally extension, so could be quite reasonably left as a follow up -- getting correct behavior for entirely standard code seems the highest priority.

If anything I would just say it's a place where mandating trivially determined/statically and control-flow free initialization logic should produce a warning that is distinct from the standard uninitialized variable warnings until robust perf-neutral (at least within a sufficiently small margin) auto-initialization are in place.

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


More information about the cfe-commits mailing list