Skip to content

Commit

Permalink
Add wrapper for Undo and fix prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnimuc committed Jun 23, 2024
1 parent df8c76f commit aa35769
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion include/clang-c/CXCppInterOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ TInterp_t clang_interpreter_getInterpreterAsPtr(CXInterpreter I);
*/
TInterp_t clang_interpreter_takeInterpreterAsPtr(CXInterpreter I);

/**
* Undo N previous incremental inputs.
*/
CXErrorCode clang_interpreter_Undo(CXInterpreter I, unsigned int N);

/**
* Dispose of the given interpreter context.
*/
Expand Down Expand Up @@ -144,7 +149,7 @@ typedef void* CXValue;
*
* \returns a \c CXValue.
*/
CXValue clang_createValue();
CXValue clang_createValue(void);

/**
* Dispose of the given CXValue.
Expand Down
6 changes: 5 additions & 1 deletion lib/Interpreter/CXCppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ TInterp_t clang_interpreter_takeInterpreterAsPtr(CXInterpreter I) {
return static_cast<CXInterpreterImpl*>(I)->Interp.release();
}

CXErrorCode clang_interpreter_Undo(CXInterpreter I, unsigned int N) {
return getInterpreter(I)->Undo(N) ? CXError_Failure : CXError_Success;

Check warning on line 74 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L73-L74

Added lines #L73 - L74 were not covered by tests
}

void clang_interpreter_dispose(CXInterpreter I) {
delete I; // NOLINT(*-owning-memory)
}
Expand Down Expand Up @@ -113,7 +117,7 @@ enum CXErrorCode clang_interpreter_process(CXInterpreter I, const char* code) {
return CXError_Success;

Check warning on line 117 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L117

Added line #L117 was not covered by tests
}

CXValue clang_createValue() {
CXValue clang_createValue(void) {

Check warning on line 120 in lib/Interpreter/CXCppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/Interpreter/CXCppInterOp.cpp#L120

Added line #L120 was not covered by tests
#ifdef USE_CLING
auto val = std::make_unique<cling::Value>();
#else
Expand Down

0 comments on commit aa35769

Please sign in to comment.