[PATCH] D154382: [ClangRepl] support code completion at a REPL
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 10:56:41 PDT 2023
v.g.vassilev added inline comments.
================
Comment at: clang/include/clang/Sema/CodeCompleteConsumer.h:342
+ /// Code completion at a top level in a REPL session.
+ CCC_ReplTopLevel,
};
----------------
================
Comment at: clang/lib/Interpreter/CodeCompletion.cpp:102
+ std::vector<CodeCompletionResult> Results;
+ auto *CConsumer = new ReplCompletionConsumer(Results);
+ auto Interp = Interpreter::createForCodeCompletion(
----------------
Let's move this in `Interpreter::createForCodeCompletion`.
================
Comment at: clang/lib/Interpreter/CodeCompletion.cpp:118
+ llvm::StringRef s;
+ if (space_pos == llvm::StringRef::npos) {
+ s = Buffer;
----------------
Please remove the braces around single statement blocks.
================
Comment at: clang/lib/Interpreter/Interpreter.cpp:304
+llvm::Expected<std::unique_ptr<Interpreter>>
+Interpreter::createForCodeCompletion(
+ IncrementalCompilerBuilder &CB, const CompilerInstance *ParentCI,
----------------
I still do not entirely understand why we can "just" ask the codecompletion infrastructure for the possible options at the current position. I know that's probably easier set than done but I'd like to entertain that idea for a while..
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154382/new/
https://reviews.llvm.org/D154382
More information about the cfe-commits
mailing list