[PATCH] D130081: Add foldings for multi-line comment.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 28 01:25:29 PDT 2022
hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:177
-// FIXME(kirillbobyrev): Collect comments, PP conditional regions, includes and
-// other code regions (e.g. public/private/protected sections of classes,
-// control flow statement bodies).
+// FIXME( usaxena95): Collect PP conditional regions, includes and other code
+// regions (e.g. public/private/protected sections of classes, control flow
----------------
nit: there is an extra space (I'd rather just use `FIXME:`)
================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:224
if (Tok.Line < Paired->Line) {
- Position Start = offsetToPosition(
- Code,
- OrigStream.tokens()[Tok.OriginalIndex].text().data() - Code.data());
- Position End = offsetToPosition(
- Code, OrigStream.tokens()[Paired->OriginalIndex].text().data() -
- Code.data());
- FoldingRange FR;
- FR.startLine = Start.line;
- FR.startCharacter = Start.character + 1;
- FR.endLine = End.line;
- FR.endCharacter = End.character;
- Result.push_back(FR);
+ Position Start = offsetToPosition(Code, 1 + StartOffset(Tok));
+ Position End = StartPosition(*Paired);
----------------
nit: add a comment explaining the +1 offset (skipping the bracket).
================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:239
+ while (T != Tokens.end() && T->Kind == tok::comment &&
+ StartPosition(*T).line <= LastCommentEnd.line + 1) {
+ LastCommentEnd = EndPosition(*T);
----------------
nit: the `<=` seems to do much --I think we care about `= LastCommentEnd.line` and `= LastCommentEnd.line + 1` cases, `< LastCommentEnd.line` should be impossible, right?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130081/new/
https://reviews.llvm.org/D130081
More information about the cfe-commits
mailing list