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

Jian Cai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 17:37:37 PDT 2020


jcai19 marked an inline comment as done.
jcai19 added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1817
+      CGM.countAutoVarInit();
+    }
+
----------------
jfb wrote:
> This isn't the right place to stop auto-init: we can get past this point even without auto-init. As-is you're introducing a change in the regular language.
> 
> I hope that some tests for whatever happens below would break if you hack your flag to always stop auto-init for any value. i.e. just on your machine, run the entire test suite with this forcibly on. Only auto-init tests should fail, the others should all still pass.
I tried to always return and it seemed only auto-init tests failed while running check-clang. But I agree this is not the right place. I have moved this piece of code. Thanks!


================
Comment at: clang/lib/CodeGen/CodeGenModule.h:305
   const CodeGenOptions &CodeGenOpts;
+  mutable unsigned NumAutoVarInit = 0;
   llvm::Module &TheModule;
----------------
jfb wrote:
> This is reachable from a context where `CodeGenModule` is `const` ? :( 
I copied it from my previous iteration and forgot to remove the keyword. Thanks for catching that.


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