-
Notifications
You must be signed in to change notification settings - Fork 31
Add error propagation to interpreter creation logic #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fb47552
536c896
b0370a0
f495d29
768af5a
4ee86d0
0268905
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,6 +167,25 @@ TEST(InterpreterTest, CreateInterpreter) { | |
#endif | ||
} | ||
|
||
#ifndef CPPINTEROP_USE_CLING | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why we are not doing this test for Cling? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No clue, I see no C-API tests done through cling and that's what I am trying to replicate. Maybe @Gnimuc can educate us here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original purpose of adding the C API is to support multiple instances. REPL and Cling are two backends for creating compiler instances. REPL is based on I think there is no plan to upstream Cling to the llvm-project, and I didn't check Cling's compatibility when I added those C-API tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can build, CppInterOp by providing cling and it will embed cling in it. If that’s not too much of work maybe we can support that, shouldn’t hurt. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have a dedicated PR for that ? I'll say the purpose of this PR is complete now.
@Gnimuc would you like to give this an attempt ? |
||
TEST(InterpreterTest, CreateInterpreterCAPI) { | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const char* argv[] = {"-std=c++17"}; | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto *CXI = clang_createInterpreter(argv, 1); | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto CLI = clang_Interpreter_getClangInterpreter(CXI); | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EXPECT_TRUE(CLI); | ||
clang_Interpreter_dispose(CXI); | ||
} | ||
|
||
TEST(InterpreterTest, CreateInterpreterCAPIFailure) { | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#ifdef _WIN32 | ||
GTEST_SKIP() << "Disabled on Windows. Needs fixing."; | ||
#endif | ||
const char* argv[] = {"-fsyntax-only", "-Xclang", "-invalid-plugin"}; | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
auto *CXI = clang_createInterpreter(argv, 3); | ||
anutosh491 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EXPECT_EQ(CXI, nullptr); | ||
} | ||
#endif | ||
|
||
#ifdef LLVM_BINARY_DIR | ||
TEST(InterpreterTest, DetectResourceDir) { | ||
#ifdef EMSCRIPTEN | ||
|
Uh oh!
There was an error while loading. Please reload this page.