From 76374573ce829b083b95b74937a11e9b91f8f45f Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 15 Jul 2021 23:52:44 +0000 Subject: Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer We can build it with -Werror=global-constructors now. This helps in situation where libSupport is embedded as a shared library, potential with dlopen/dlclose scenario, and when command-line parsing or other facilities may not be involved. Avoiding the implicit construction of these cl::opt can avoid double-registration issues and other kind of behavior. Reviewed By: lattner, jpienaar Differential Revision: https://reviews.llvm.org/D105959 --- llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp') diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index 9b01ff5..ef4aec5 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -571,7 +571,7 @@ static Expected parseCommandLine(int Argc, char **Argv) { int main(int Argc, char **Argv) { InitLLVM X(Argc, Argv); - cl::HideUnrelatedOptions({&LibtoolCategory, &ColorCategory}); + cl::HideUnrelatedOptions({&LibtoolCategory, &getColorCategory()}); Expected ConfigOrErr = parseCommandLine(Argc, Argv); if (!ConfigOrErr) { WithColor::defaultErrorHandler(ConfigOrErr.takeError()); -- cgit v1.1