Skip to content

Commit b2c8c77

Browse files
kr-2003anutosh491
authored andcommitted
added unload feature for cling
1 parent df9344b commit b2c8c77

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
@@ -3674,7 +3674,10 @@ namespace Cpp {
36743674

36753675
int Undo(unsigned N) {
36763676
#ifdef CPPINTEROP_USE_CLING
3677-
return compat::Interpreter::kFailure;
3677+
auto &I = getInterp();
3678+
cling::Interpreter::PushTransactionRAII RAII(&I);
3679+
I.unload(N);
3680+
return compat::Interpreter::kSuccess;
36783681
#else
36793682
return getInterp().undo(N);
36803683
#endif

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,11 +1529,7 @@ TEST(FunctionReflectionTest, UndoTest) {
15291529
testing::internal::CaptureStderr();
15301530
Cpp::Process("int y = x;");
15311531
cerrs = testing::internal::GetCapturedStderr();
1532-
EXPECT_STREQ(
1533-
cerrs.c_str(),
1534-
"In file included from <<< inputs >>>:1:\ninput_line_2:1:9: error: use "
1535-
"of undeclared identifier 'x'\n 1 | int y = x;\n | "
1536-
"^\nFailed to parse via ::process:Parsing failed.\n");
1532+
EXPECT_TRUE(strstr(cerrs.c_str(), "error: use of undeclared identifier 'x'") != nullptr);
15371533
testing::internal::CaptureStderr();
15381534
Cpp::Process("int x = 10;");
15391535
cerrs = testing::internal::GetCapturedStderr();

0 commit comments

Comments
 (0)