[llvm] r304157 - Try to work around MSVC being buggy. Attempt #1.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Mon May 29 07:28:04 PDT 2017
Author: d0k
Date: Mon May 29 09:28:04 2017
New Revision: 304157
URL: http://llvm.org/viewvc/llvm-project?rev=304157&view=rev
Log:
Try to work around MSVC being buggy. Attempt #1.
error C2971: 'llvm::ManagedStatic': template parameter 'Creator': 'CreateDefaultTimerGroup': a variable with non-static storage duration cannot be used as a non-type argument
Modified:
llvm/trunk/lib/Support/Timer.cpp
llvm/trunk/unittests/Support/ManagedStatic.cpp
Modified: llvm/trunk/lib/Support/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=304157&r1=304156&r2=304157&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Timer.cpp (original)
+++ llvm/trunk/lib/Support/Timer.cpp Mon May 29 09:28:04 2017
@@ -72,9 +72,11 @@ std::unique_ptr<raw_fd_ostream> llvm::Cr
return llvm::make_unique<raw_fd_ostream>(2, false); // stderr.
}
-static void *CreateDefaultTimerGroup() {
+namespace {
+void *CreateDefaultTimerGroup() {
return new TimerGroup("misc", "Miscellaneous Ungrouped Timers");
}
+} // namespace
static ManagedStatic<TimerGroup, CreateDefaultTimerGroup> DefaultTimerGroup;
static TimerGroup *getDefaultTimerGroup() { return &*DefaultTimerGroup; }
Modified: llvm/trunk/unittests/Support/ManagedStatic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ManagedStatic.cpp?rev=304157&r1=304156&r2=304157&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ManagedStatic.cpp (original)
+++ llvm/trunk/unittests/Support/ManagedStatic.cpp Mon May 29 09:28:04 2017
@@ -86,7 +86,7 @@ TEST(ManagedStaticTest, NestedStatics) {
} // namespace NestedStatics
namespace CustomCreatorDeletor {
-static void *CustomCreate() {
+void *CustomCreate() {
void *Mem = std::malloc(sizeof(int));
*((int *)Mem) = 42;
return Mem;
More information about the llvm-commits
mailing list