[PATCH] D154382: [ClangRepl] support code completion at a REPL

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 23:16:32 PDT 2023


v.g.vassilev added a comment.

Can you extend the commit log to include a description of how things are currently done? For example, it would be good to read about design and technical decisions, etc.



================
Comment at: clang/lib/Interpreter/CodeCompletion.cpp:79
+  if (auto Err = Interp.takeError()) {
+    llvm::consumeError(std::move(Err));
+    return Comps;
----------------
Why we drop the error on the floor?


================
Comment at: clang/lib/Interpreter/CodeCompletion.cpp:84
+  std::string AllCodeText =
+      MainInterp.getAllInput() + "\nvoid dummy(){\n" + Buffer.str() + "}";
+  auto Lines = std::count(AllCodeText.begin(), AllCodeText.end(), '\n') + 1;
----------------
I am not sure why we need to wrap this code. Can we teach the `TopLevelStmtDecl` to work with the code completion logic?


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