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

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 14:52:00 PDT 2026


================
@@ -59,13 +63,27 @@ class VarBypassDetector {
     return AlwaysBypassed || Bypasses.contains(D);
   }
 
+  /// Returns true if jump sources cannot be determined (e.g. computed gotos),
+  /// so all variables must be treated as bypassed.
+  bool isAlwaysBypassed() const { return AlwaysBypassed; }
+
+  /// Returns the variables bypassed by jumps from the given source statement,
+  /// or nullptr if it bypasses none.
+  const llvm::DenseSet<const VarDecl *> *
----------------
nickdesaulniers wrote:

I think the use of `llvm::DenseSet` might break `-ftrivial-auto-var-init-stop-after=` or at least introduce non-deterministic iteration order.

https://llvm.org/docs/CodingStandards.html#beware-of-non-determinism-due-to-ordering-of-pointers

Should you perhaps be using a `llvm::SmallSetVector` instead?

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


More information about the cfe-commits mailing list