[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-31 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. sammccall marked an inline comment as done. Closed by commit rL367453: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree. (authored by sammccall, committed by ). Herald added a project: LLVM. Herald added

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-31 Thread Sam McCall via Phabricator via cfe-commits
sammccall marked 2 inline comments as done. sammccall added inline comments. Comment at: clang-tools-extra/clangd/Selection.cpp:50 + S.StartOffset = SM.getFileOffset(Tok.location()); + S.EndOffset = S.StartOffset + Tok.length(); + if (S.StartOffset >= SelBegin && S

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-31 Thread Shaurya Gupta via Phabricator via cfe-commits
SureYeaah added inline comments. Comment at: clang-tools-extra/clangd/Selection.cpp:50 + S.StartOffset = SM.getFileOffset(Tok.location()); + S.EndOffset = S.StartOffset + Tok.length(); + if (S.StartOffset >= SelBegin && S.EndOffset <= SelEnd) Would

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-31 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision. kadircet added a comment. This revision is now accepted and ready to land. Thanks for the comments, LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65486/new/ https://reviews.llvm.org/D65486 _

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-31 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 212536. sammccall added a comment. Improve comments in SelectedTokens. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65486/new/ https://reviews.llvm.org/D65486 Files: clang-tools-extra/clangd/Selection.cpp

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. It occurs to me that `claim` is `O(node_tokens + log total_tokens)` which is bad when the nodes are large. Indeed for an input like `namespace { namespace { namespace { ... } } }` time is quadratic. I think this is probably fine in practice. Against adversarial input

[PATCH] D65486: [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.

2019-07-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision. sammccall added reviewers: SureYeaah, kadircet. Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay. Herald added a project: clang. Whitespace and comments are a clear bugfix: selecting some comments/space near a statement doesn't mean you're selectin