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

Fred Fu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 15:40:19 PDT 2023


capfredf updated this revision to Diff 537910.
capfredf added a comment.

move the comment up


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154382/new/

https://reviews.llvm.org/D154382

Files:
  clang/lib/Interpreter/CodeCompletion.cpp


Index: clang/lib/Interpreter/CodeCompletion.cpp
===================================================================
--- clang/lib/Interpreter/CodeCompletion.cpp
+++ clang/lib/Interpreter/CodeCompletion.cpp
@@ -81,8 +81,6 @@
     return Comps;
   }
 
-  std::string AllCodeText = "void __dummy(){\n" + Buffer.str();
-
   // We need to wrap our input because we need `Sema::CodeCompleteOrdinaryName`
   // to work on code from the REPL in a statement completion context. By
   // default, `Sema::CodeCompleteOrdinaryName` thinks the input is a regular c++
@@ -102,6 +100,7 @@
   // Since top-level expressions are not supported, `foo` should not be an
   // option. But in a REPL session, we should be allowed to use `foo` to make a
   // statement like `foo + 84;`.
+  std::string AllCodeText = "void __dummy(){\n" + Buffer.str();
 
   auto Lines = std::count(AllCodeText.begin(), AllCodeText.end(), '\n') + 1;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154382.537910.patch
Type: text/x-patch
Size: 912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230706/d07e7444/attachment.bin>


More information about the cfe-commits mailing list