diff --git a/lib/Interpreter/Compatibility.h b/lib/Interpreter/Compatibility.h index 4db642617..7fb3765e0 100644 --- a/lib/Interpreter/Compatibility.h +++ b/lib/Interpreter/Compatibility.h @@ -73,6 +73,34 @@ getSymbolAddress(const cling::Interpreter& I, llvm::StringRef IRName) { Names.push_back(Jit.getExecutionSession().intern(IRName)); return llvm::make_error(Names); } + +inline void codeComplete(cling::Interpreter& I, const char* code, std::vector& Results) { + std::vector results; + cling::Interpreter::CompilationResult compilation_result; + + compilation_result = I.codeComplete(code, std::string(code).size() + 1, results); + + for (auto& r : results) { + printf("!!!%s\n", r.c_str()); + //if (r.find(CC.Prefix) == 0) + Results.push_back(r); + } + +/* + for (auto& r : result) { + // remove the definition at the beginning (for example [#int#]) + r = std::regex_replace(r, std::regex("\\[\\#.*\\#\\]"), ""); + // remove the variable name in <#type name#> + r = std::regex_replace(r, std::regex("(\\ |\\*)+(\\w+)(\\#\\>)"), "$1$3"); + // remove unnecessary space at the end of <#type #> + r = std::regex_replace(r, std::regex("\\ *(\\#\\>)"), "$1"); + // remove <# #> to keep only the type + r = std::regex_replace(r, std::regex("\\<\\#([^#>]*)\\#\\>"), "$1"); + } +*/ + //assert(false && "CodeCompletion API is not implemented yet."); +} + } // namespace compat #endif // USE_CLING