Skip to content

Commit c2130c8

Browse files
fix: by forcing to compile empty code block
1 parent 68018f1 commit c2130c8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/CppInterOp/CppInterOp.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,14 @@ int get_wrapper_code(compat::Interpreter& I, const FunctionDecl* FD,
24672467
S.InstantiateFunctionDefinition(SourceLocation(), FDmod,
24682468
/*Recursive=*/true,
24692469
/*DefinitionRequired=*/true);
2470+
// TODO: Will need to replace this with a RAII for clang-repl too
2471+
auto GeneratedPTU = I.Parse("");
2472+
if (!GeneratedPTU)
2473+
llvm::logAllUnhandledErrors(
2474+
GeneratedPTU.takeError(), llvm::errs(),
2475+
"[MakeFunctionCallable -> InstantiateFunctionDefinition] Failed to "
2476+
"generate PTU:");
2477+
24702478
if (!FD->isDefined(Definition)) {
24712479
llvm::errs() << "TClingCallFunc::make_wrapper"
24722480
<< ":"

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,6 @@ TEST(FunctionReflectionTest, FailingTest1) {
21472147
EXPECT_TRUE(fn);
21482148
Cpp::JitCall jit_call = Cpp::MakeFunctionCallable(fn);
21492149
EXPECT_EQ(jit_call.getKind(), Cpp::JitCall::kUnknown); // expected to fail
2150-
EXPECT_FALSE(Cpp::Declare("int x = 1;")); // expected to pass, but fails
2151-
EXPECT_FALSE(Cpp::Declare(
2152-
"int y = 1;")); // expected to pass, and passes on second attempt
2150+
EXPECT_FALSE(Cpp::Declare("int x = 1;"));
2151+
EXPECT_FALSE(Cpp::Declare("int y = x;"));
21532152
}

0 commit comments

Comments
 (0)