Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/Interpreter/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,16 @@ getSymbolAddress(clang::Interpreter& I, clang::GlobalDecl GD) {
}

inline llvm::Expected<llvm::JITTargetAddress>
getSymbolAddressFromLinkerName(const clang::Interpreter& I,
getSymbolAddressFromLinkerName(clang::Interpreter& I,
llvm::StringRef LinkerName) {
#if CLANG_VERSION_MAJOR >= 14
auto AddrOrErr = I.getSymbolAddressFromLinkerName(LinkerName);
const auto& DL = getExecutionEngine(I)->getDataLayout();
char GlobalPrefix = DL.getGlobalPrefix();
std::string LinkerNameTmp(LinkerName);
if (GlobalPrefix != '\0') {
LinkerNameTmp = std::string(1, GlobalPrefix) + LinkerNameTmp;
}
auto AddrOrErr = I.getSymbolAddressFromLinkerName(LinkerNameTmp);
if (llvm::Error Err = AddrOrErr.takeError())
return std::move(Err);
return AddrOrErr->getValue();
Expand Down
8 changes: 7 additions & 1 deletion lib/Interpreter/CppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,13 @@ namespace Cpp {
// Let's inject it.
SymbolMap::iterator It;
llvm::orc::SymbolMap InjectedSymbols;
auto Name = ES.intern(linker_mangled_name);
auto& DL = compat::getExecutionEngine(I)->getDataLayout();
char GlobalPrefix = DL.getGlobalPrefix();
std::string tmp(linker_mangled_name);
if (GlobalPrefix != '\0') {
tmp = std::string(1, GlobalPrefix) + tmp;
}
auto Name = ES.intern(tmp);
InjectedSymbols[Name] =
#if CLANG_VERSION_MAJOR < 17
JITEvaluatedSymbol(address,
Expand Down
17 changes: 1 addition & 16 deletions unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,7 @@ TEST(FunctionReflectionTest, IsVirtualMethod) {
EXPECT_FALSE(Cpp::IsVirtualMethod(Decls[0]));
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_JitCallAdvanced) {
#else
TEST(FunctionReflectionTest, JitCallAdvanced) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
typedef struct _name {
Expand All @@ -617,11 +613,8 @@ TEST(FunctionReflectionTest, JitCallAdvanced) {
Cpp::Destruct(object, Decls[1]);
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_GetFunctionCallWrapper) {
#else

TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
int f1(int i) { return i * i; }
Expand Down Expand Up @@ -784,11 +777,7 @@ TEST(FunctionReflectionTest, GetFunctionArgDefault) {
EXPECT_EQ(Cpp::GetFunctionArgDefault(Decls[1], 2), "34126");
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Construct) {
#else
TEST(FunctionReflectionTest, Construct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -822,11 +811,7 @@ TEST(FunctionReflectionTest, Construct) {
EXPECT_EQ(output, "Constructor Executed");
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Destruct) {
#else
TEST(FunctionReflectionTest, Destruct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down
4 changes: 0 additions & 4 deletions unittests/CppInterOp/InterpreterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ TEST(InterpreterTest, Evaluate) {
EXPECT_FALSE(HadError) ;
}

#ifdef __APPLE__ //Fails for Cling Tests
TEST(InterpreterTest, DISABLED_Process) {
#else
TEST(InterpreterTest, Process) {
#endif
Cpp::CreateInterpreter();
EXPECT_TRUE(Cpp::Process("") == 0);
EXPECT_TRUE(Cpp::Process("int a = 12;") == 0);
Expand Down
4 changes: 0 additions & 4 deletions unittests/CppInterOp/JitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ static int printf_jit(const char* format, ...) {
return 0;
}

#ifdef __APPLE__
TEST(JitTest, DISABLED_InsertOrReplaceJitSymbol) {
#else
TEST(JitTest, InsertOrReplaceJitSymbol) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
extern "C" int printf(const char*,...);
Expand Down
18 changes: 2 additions & 16 deletions unittests/CppInterOp/ScopeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,8 @@ TEST(ScopeReflectionTest, SizeOf) {
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t)16);
}

#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IsBuiltin) {
#else

TEST(ScopeReflectionTest, IsBuiltin) {
#endif
// static std::set<std::string> g_builtins =
// {"bool", "char", "signed char", "unsigned char", "wchar_t", "short", "unsigned short",
// "int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long",
Expand Down Expand Up @@ -433,11 +430,7 @@ TEST(ScopeReflectionTest, GetScopefromCompleteName) {
EXPECT_EQ(Cpp::GetQualifiedName(Cpp::GetScopeFromCompleteName("N1::N2::C::S")), "N1::N2::C::S");
}

#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_GetNamed) {
#else
TEST(ScopeReflectionTest, GetNamed) {
#endif
std::string code = R"(namespace N1 {
namespace N2 {
class C {
Expand Down Expand Up @@ -761,11 +754,7 @@ TEST(ScopeReflectionTest, InstantiateNNTPClassTemplate) {
/*type_size*/ args1.size()));
}

#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_InstantiateTemplateFunctionFromString) {
#else
TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) {
#endif
Cpp::CreateInterpreter();
std::string code = R"(#include <memory>)";
Interp->process(code);
Expand Down Expand Up @@ -905,11 +894,8 @@ TEST(ScopeReflectionTest, GetClassTemplateInstantiationArgs) {
EXPECT_TRUE(instance_types.size() == 0);
}

#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IncludeVector) {
#else

TEST(ScopeReflectionTest, IncludeVector) {
#endif
std::string code = R"(
#include <vector>
#include <iostream>
Expand Down
4 changes: 0 additions & 4 deletions unittests/CppInterOp/TypeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,7 @@ TEST(TypeReflectionTest, IsPODType) {
EXPECT_FALSE(Cpp::IsPODType(0));
}

#ifdef __APPLE__
TEST(TypeReflectionTest, DISABLED_IsSmartPtrType) {
#else
TEST(TypeReflectionTest, IsSmartPtrType) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down