llvm/llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryTest.cpp --------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#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"

// FIXME: Missing globals/DSO https://github.com/llvm/llvm-project/issues/57206.
#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