[llvm] 7326aa7 - Workaround -Wglobal-constructor warning. (#94699)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 11:28:47 PDT 2024


Author: Eric Schweitz
Date: 2024-06-10T11:28:44-07:00
New Revision: 7326aa7a0e186a189d4d42010ca66a3889d3fe75

URL: https://github.com/llvm/llvm-project/commit/7326aa7a0e186a189d4d42010ca66a3889d3fe75
DIFF: https://github.com/llvm/llvm-project/commit/7326aa7a0e186a189d4d42010ca66a3889d3fe75.diff

LOG: Workaround -Wglobal-constructor warning. (#94699)

This line was tripping the -Wglobal-constructor warning which was
causing a build failure when -Werror was turned on.

Added: 
    

Modified: 
    llvm/lib/Support/CodeGenCoverage.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CodeGenCoverage.cpp b/llvm/lib/Support/CodeGenCoverage.cpp
index 4d41c42e527e2..2e35019e12c16 100644
--- a/llvm/lib/Support/CodeGenCoverage.cpp
+++ b/llvm/lib/Support/CodeGenCoverage.cpp
@@ -21,8 +21,6 @@
 
 using namespace llvm;
 
-static sys::SmartMutex<true> OutputMutex;
-
 CodeGenCoverage::CodeGenCoverage() = default;
 
 void CodeGenCoverage::setCovered(uint64_t RuleID) {
@@ -79,6 +77,7 @@ bool CodeGenCoverage::parse(MemoryBuffer &Buffer, StringRef BackendName) {
 bool CodeGenCoverage::emit(StringRef CoveragePrefix,
                            StringRef BackendName) const {
   if (!CoveragePrefix.empty() && !RuleCoverage.empty()) {
+    static sys::SmartMutex<true> OutputMutex;
     sys::SmartScopedLock<true> Lock(OutputMutex);
 
     // We can handle locking within a process easily enough but we don't want to


        


More information about the llvm-commits mailing list