[PATCH] D77168: Add a flag to debug automatic variable initialization

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 15:59:57 PDT 2020


MaskRay added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1814
+    if (StopAfter) {
+      static unsigned Counter = 0;
+      if (Counter >= StopAfter)
----------------
I am a bit worried about the static variable. This makes CodeGen not reusable.


================
Comment at: clang/test/CodeGenCXX/auto-var-init-stop-after.cpp:1
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-stop-after=2 %s -emit-llvm -o - | FileCheck %s -check-prefix=PATTERN-STOP-AFTER-2
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern -ftrivial-auto-var-init-stop-after=3 %s -emit-llvm -o - | FileCheck %s -check-prefix=PATTERN-STOP-AFTER-3
----------------
You can drop `-fblocks`, because the test has nothing to do with the Blocks extension.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77168/new/

https://reviews.llvm.org/D77168





More information about the cfe-commits mailing list