Skip to content

Commit 0f3a940

Browse files
author
kr-2003
committed
added unload feature for cling
1 parent c7c0903 commit 0f3a940

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/Interpreter/CppInterOp.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3618,7 +3618,10 @@ namespace Cpp {
36183618

36193619
int Undo(unsigned N) {
36203620
#ifdef CPPINTEROP_USE_CLING
3621-
return compat::Interpreter::kFailure;
3621+
auto &I = getInterp();
3622+
cling::Interpreter::PushTransactionRAII RAII(&I);
3623+
I.unload(N);
3624+
return compat::Interpreter::kSuccess;
36223625
#else
36233626
return getInterp().undo(N);
36243627
#endif

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,11 +1263,7 @@ TEST(FunctionReflectionTest, UndoTest) {
12631263
testing::internal::CaptureStderr();
12641264
Cpp::Process("int y = x;");
12651265
cerrs = testing::internal::GetCapturedStderr();
1266-
EXPECT_STREQ(
1267-
cerrs.c_str(),
1268-
"In file included from <<< inputs >>>:1:\ninput_line_2:1:9: error: use "
1269-
"of undeclared identifier 'x'\n 1 | int y = x;\n | "
1270-
"^\nFailed to parse via ::process:Parsing failed.\n");
1266+
EXPECT_TRUE(strstr(cerrs.c_str(), "error: use of undeclared identifier 'x'") != nullptr);
12711267
testing::internal::CaptureStderr();
12721268
Cpp::Process("int x = 10;");
12731269
cerrs = testing::internal::GetCapturedStderr();

0 commit comments

Comments
 (0)