#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Allocator.h"
#include "gtest/gtest.h"
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#include "gtest/gtest.h"
usingnamespacellvm;
namespace {
#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) && \
!__has_feature(memory_sanitizer)
namespace test1 {
llvm::ManagedStatic<int> ms;
void *helper(void*) { … }
void *allocate_stack(pthread_attr_t &a, size_t n = 65536) { … }
}
TEST(Initialize, MultipleThreads) { … }
#endif
namespace NestedStatics {
static ManagedStatic<int> Ms1;
struct Nest { … };
static ManagedStatic<Nest> Ms2;
TEST(ManagedStaticTest, NestedStatics) { … }
}
namespace CustomCreatorDeletor {
struct CustomCreate { … };
struct CustomDelete { … };
static ManagedStatic<int, CustomCreate, CustomDelete> Custom;
TEST(ManagedStaticTest, CustomCreatorDeletor) { … }
}
}