diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-05-29 20:56:27 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-05-29 20:56:27 +0000 |
commit | 74de08031f5d31da055eead7af9e22411cd794b4 (patch) | |
tree | fa73f0680d9c31dd171d0ae574b5175b49dba266 /llvm/unittests/Support/ManagedStatic.cpp | |
parent | af66659d6b6431b784c02f9ce6433062cc97c96c (diff) | |
download | bcm5719-llvm-74de08031f5d31da055eead7af9e22411cd794b4.tar.gz bcm5719-llvm-74de08031f5d31da055eead7af9e22411cd794b4.zip |
[ManagedStatic] Avoid putting function pointers in template args.
This is super awkward, but GCC doesn't let us have template visible when
an argument is an inline function and -fvisibility-inlines-hidden is
used.
llvm-svn: 304175
Diffstat (limited to 'llvm/unittests/Support/ManagedStatic.cpp')
-rw-r--r-- | llvm/unittests/Support/ManagedStatic.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/unittests/Support/ManagedStatic.cpp b/llvm/unittests/Support/ManagedStatic.cpp index 96f9e92c6e0..4e2e93036a8 100644 --- a/llvm/unittests/Support/ManagedStatic.cpp +++ b/llvm/unittests/Support/ManagedStatic.cpp @@ -82,12 +82,17 @@ TEST(ManagedStaticTest, NestedStatics) { } // namespace NestedStatics namespace CustomCreatorDeletor { -void *CustomCreate() { - void *Mem = std::malloc(sizeof(int)); - *((int *)Mem) = 42; - return Mem; -} -static ManagedStatic<int, CustomCreate, std::free> Custom; +struct CustomCreate { + static void *call() { + void *Mem = std::malloc(sizeof(int)); + *((int *)Mem) = 42; + return Mem; + } +}; +struct CustomDelete { + static void call(void *P) { std::free(P); } +}; +static ManagedStatic<int, CustomCreate, CustomDelete> Custom; TEST(ManagedStaticTest, CustomCreatorDeletor) { EXPECT_EQ(42, *Custom); } |