[clang] [clang-tools-extra] [clangd] Add InsertReplaceEdit for code completion (PR #187623)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 01:41:25 PDT 2026
================
@@ -2232,16 +2274,55 @@ CompletionPrefix guessCompletionPrefix(llvm::StringRef Content,
return Result;
}
+// If Offset is inside what looks like argument comment (e.g.
+// "/*^*/" or "/* foo = ^*/"), returns the offset pointing past the closing
+// "*/".
+static std::optional<unsigned>
+maybeFunctionArgumentCommentEnd(const PathRef FileName, const unsigned Offset,
+ const llvm::StringRef Content,
+ const LangOptions &LangOpts) {
+ if (Offset > Content.size())
+ return std::nullopt;
+
+ SourceManagerForFile FileSM(FileName, Content);
+ const SourceManager &SM = FileSM.get();
+ const SourceLocation Cursor =
+ SM.getComposedLoc(SM.getMainFileID(), static_cast<unsigned>(Offset));
----------------
timon-ul wrote:
Why do we have a `static_cast` here?
https://github.com/llvm/llvm-project/pull/187623
More information about the cfe-commits
mailing list