Skip to content

Commit 452df19

Browse files
committed
Workaround -Wglobal-constructor warning.
This line was tripping the -Wglobal-constructor warning which was causing a build failure when -Werror was turned on.
1 parent 21f5ee0 commit 452df19

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Support/CodeGenCoverage.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121

2222
using namespace llvm;
2323

24-
static sys::SmartMutex<true> OutputMutex;
24+
static sys::SmartMutex<true> &OutputMutex() {
25+
static sys::SmartMutex<true> mutex;
26+
return mutex;
27+
}
2528

2629
CodeGenCoverage::CodeGenCoverage() = default;
2730

@@ -79,7 +82,7 @@ bool CodeGenCoverage::parse(MemoryBuffer &Buffer, StringRef BackendName) {
7982
bool CodeGenCoverage::emit(StringRef CoveragePrefix,
8083
StringRef BackendName) const {
8184
if (!CoveragePrefix.empty() && !RuleCoverage.empty()) {
82-
sys::SmartScopedLock<true> Lock(OutputMutex);
85+
sys::SmartScopedLock<true> Lock(OutputMutex());
8386

8487
// We can handle locking within a process easily enough but we don't want to
8588
// manage it between multiple processes. Use the process ID to ensure no

0 commit comments

Comments
 (0)