#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
#include "PipSqueak.h"
#if !LLVM_HWADDRESS_SANITIZER_BUILD
usingnamespacellvm;
usingnamespacellvm::sys;
std::string LibPath(const std::string Name = "PipSqueak") { … }
#if defined(_WIN32) || (defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN))
SetStrings;
TestOrder;
GetString;
template <class T> static T FuncPtr(void *Ptr) { … }
template <class T> static void* PtrFunc(T *Func) { … }
static const char *OverloadTestA() { … }
std::string StdString(const char *Ptr) { … }
TEST(DynamicLibrary, Overload) { … }
#else
TEST(DynamicLibrary, Unsupported) {
std::string Err;
DynamicLibrary DL =
DynamicLibrary::getPermanentLibrary(LibPath().c_str(), &Err);
EXPECT_FALSE(DL.isValid());
EXPECT_EQ(Err, "dlopen() not supported on this platform");
}
#endif
#endif