Skip to content

Commit

Permalink
Tweak invoke API and make JitCall internal
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnimuc committed Jul 21, 2024
1 parent 4d0eaab commit b91ca6c
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions lib/Interpreter/CXCppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,36 +1360,17 @@ CXObject clang_construct(CXScope scope, void* arena) {
return nullptr;

Check warning on line 1360 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L1360

Added line #L1360 was not covered by tests
}

void clang_invoke(CXScope func, void* result, void** args, size_t n,

Check warning on line 1363 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L1363

Added line #L1363 was not covered by tests
void* self) {
Cpp::MakeFunctionCallableImpl(getInterpreter(func), getDecl(func))
.Invoke(result, {args, n}, self);

Check warning on line 1366 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L1365-L1366

Added lines #L1365 - L1366 were not covered by tests
}

namespace Cpp {
void DestructImpl(compat::Interpreter& interp, TCppObject_t This,
clang::Decl* Class, bool withFree);
} // namespace Cpp

void clang_destruct(CXObject This, CXScope S, bool withFree) {
Cpp::DestructImpl(*getInterpreter(S), This, getDecl(S), withFree);

Check warning on line 1375 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L1374-L1375

Added lines #L1374 - L1375 were not covered by tests
}

CXJitCall clang_jitcall_create(CXScope func) {
auto J = Cpp::MakeFunctionCallableImpl(getInterpreter(func), getDecl(func));
auto Ptr = std::make_unique<Cpp::JitCall>(J);
return reinterpret_cast<CXJitCall>(Ptr.release()); // NOLINT(*-cast)
}

void clang_jitcall_dispose(CXJitCall J) {
delete reinterpret_cast<Cpp::JitCall*>(J); // NOLINT(*-owning-memory, *-cast)
}

CXJitCallKind clang_jitcall_getKind(CXJitCall J) {
const auto* call = reinterpret_cast<Cpp::JitCall*>(J); // NOLINT(*-cast)
return static_cast<CXJitCallKind>(call->getKind());
}

bool clang_jitcall_isValid(CXJitCall J) {
return reinterpret_cast<Cpp::JitCall*>(J)->isValid(); // NOLINT(*-cast)
}

void clang_jitcall_invoke(CXJitCall J, void* result, void** args,
unsigned int n, void* self) {
const auto* call = reinterpret_cast<Cpp::JitCall*>(J); // NOLINT(*-cast)
call->Invoke(result, {args, n}, self);
}

0 comments on commit b91ca6c

Please sign in to comment.