[PATCH] D105959: Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 18:54:59 PDT 2021
mehdi_amini added inline comments.
================
Comment at: llvm/lib/Support/CMakeLists.txt:7
+# ManagedStatic can be used to enable lazy-initialization of globals.
+add_flag_if_supported("-Werror=global-constructors" WERROR_GLOBAL_CONSTRUCTOR)
+
----------------
MaskRay wrote:
> Perhaps move this to a separate change.
Sure, I can commit this separately.
================
Comment at: llvm/lib/Support/Debug.cpp:96
//until program termination.
-static cl::opt<unsigned>
-DebugBufferSize("debug-buffer-size",
- cl::desc("Buffer the last N characters of debug output "
- "until program termination. "
- "[default 0 -- immediate print-out]"),
- cl::Hidden,
- cl::init(0));
+struct CreateDebugBufferSize {
+ static void *call() {
----------------
jpienaar wrote:
> Why not in anonymous namespace too? (consistenly everywhere)
I think it is already?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105959/new/
https://reviews.llvm.org/D105959
More information about the llvm-commits
mailing list