Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ TYPED_TEST(CPPINTEROP_TEST_MODE, Interpreter_DetectSystemCompilerIncludePaths) {
TYPED_TEST(CPPINTEROP_TEST_MODE, Interpreter_IncludePaths) {
if (TypeParam::isOutOfProcess)
GTEST_SKIP() << "Test fails for OOP JIT builds";
TestFixture::CreateInterpreter();
std::vector<std::string> includes;
Cpp::GetIncludePaths(includes);
EXPECT_FALSE(includes.empty());
Expand Down Expand Up @@ -955,7 +956,8 @@ TYPED_TEST(CPPINTEROP_TEST_MODE, Interpreter_GetLanguageStandardGNU) {
}

TYPED_TEST(CPPINTEROP_TEST_MODE, Interpreter_ExternalInterpreter) {

// UseExternalInterpreter must refuse while an interpreter is registered.
TestFixture::CreateInterpreter();

#ifndef CPPINTEROP_USE_CLING
llvm::ExitOnError ExitOnErr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@
}

TYPED_TEST(CPPINTEROP_TEST_MODE, ScopeReflection_GetGlobalScope) {
TestFixture::CreateInterpreter();
EXPECT_EQ(Cpp::GetQualifiedName(Cpp::GetGlobalScope()), "");
EXPECT_EQ(Cpp::GetName(Cpp::GetGlobalScope()), "");
}
Expand Down Expand Up @@ -1263,7 +1264,7 @@
explicit LazyDefinitionSource(std::map<std::string, std::string> Defs)
: Pending(std::move(Defs)) {}

void CompleteType(clang::TagDecl* Tag) override {

Check warning on line 1267 in interpreter/CppInterOp/unittests/CppInterOp/ScopeReflectionTest.cpp

View workflow job for this annotation

GitHub Actions / alma8

by ‘virtual void {anonymous}::LazyDefinitionSource::CompleteType(clang::TagDecl*)’ [-Woverloaded-virtual]
auto It = Pending.find(Tag->getName().str());
if (It == Pending.end())
return;
Expand Down
16 changes: 16 additions & 0 deletions interpreter/CppInterOp/unittests/CppInterOp/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ bool HasRuntimeModulemaps() {
}
}

namespace {
// Interpreters do not outlive the test that created them: kept alive, they
// pile up for the whole run and exhaust a 32-bit address space.
class DeleteInterpretersOnTestEnd : public ::testing::EmptyTestEventListener {
void OnTestEnd(const ::testing::TestInfo& /*info*/) override {
while (Cpp::DeleteInterpreter())
;
}
};
[[maybe_unused]] const bool kDeleteInterpretersOnTestEnd = [] {
::testing::UnitTest::GetInstance()->listeners().Append(
new DeleteInterpretersOnTestEnd);
return true;
}();
} // namespace

void TestUtils::GetAllTopLevelDecls(
const std::string& code, std::vector<Decl*>& Decls,
bool filter_implicitGenerated /* = false */,
Expand Down
Loading