Skip to content

Commit a66d6ce

Browse files
committed
Update ifdef REPL to ifndef CLING
1 parent 1e18aa7 commit a66d6ce

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

unittests/CppInterOp/InterpreterTest.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "cling/Interpreter/Interpreter.h"
88
#endif // USE_CLING
99

10+
#ifndef USE_CLING
1011
#include "clang/Interpreter/Interpreter.h"
1112

1213
#include "clang/Basic/Version.h"
@@ -106,6 +107,16 @@ TEST(InterpreterTest, CreateInterpreter) {
106107
"#endif");
107108
EXPECT_TRUE(Cpp::GetNamed("cpp17"));
108109
EXPECT_FALSE(Cpp::GetNamed("cppUnknown"));
110+
111+
#ifndef USE_CLING
112+
// C API
113+
auto CXI = clang_createInterpreterFromRawPtr(I);
114+
auto CLI = clang_Interpreter_getClangInterpreter(CXI);
115+
EXPECT_TRUE(CLI);
116+
auto I2 = clang_Interpreter_takeInterpreterAsPtr(CXI);
117+
EXPECT_EQ(I, I2);
118+
clang_Interpreter_dispose(CXI);
119+
#endif // USE_REPL
109120
}
110121

111122
#ifdef LLVM_BINARY_DIR
@@ -176,6 +187,7 @@ TEST(InterpreterTest, ExternalInterpreterTest) {
176187
if (llvm::sys::RunningOnValgrind())
177188
GTEST_SKIP() << "XFAIL due to Valgrind report";
178189

190+
#ifndef USE_CLING
179191
llvm::ExitOnError ExitOnErr;
180192
clang::IncrementalCompilerBuilder CB;
181193
CB.SetCompilerArgs({"-std=c++20"});
@@ -188,6 +200,7 @@ if (llvm::sys::RunningOnValgrind())
188200
std::unique_ptr<clang::Interpreter> I =
189201
ExitOnErr(clang::Interpreter::create(std::move(CI)));
190202
auto ExtInterp = I.get();
203+
#endif // USE_REPL
191204

192205
#ifdef USE_CLING
193206
std::string MainExecutableName = sys::fs::getMainExecutable(nullptr, nullptr);
@@ -207,6 +220,7 @@ if (llvm::sys::RunningOnValgrind())
207220
#endif
208221
EXPECT_TRUE(Cpp::GetInterpreter()) << "External Interpreter not set";
209222

223+
#ifndef USE_CLING
210224
I.release();
211225

212226
#ifdef USE_CLING

0 commit comments

Comments
 (0)