diff options
author | Sam McCall <sam.mccall@gmail.com> | 2019-07-31 17:52:40 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2019-07-31 17:52:40 +0000 |
commit | abe3c29a8c83c092e53c5203818de829c44dc4e3 (patch) | |
tree | 782f8da121a7ef7d2025c254fd8fe98dbf5cf380 /lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp | |
parent | 46ba9697520f3978b094a880e9ae59fa4639c88c (diff) | |
download | bcm5719-llvm-abe3c29a8c83c092e53c5203818de829c44dc4e3.tar.gz bcm5719-llvm-abe3c29a8c83c092e53c5203818de829c44dc4e3.zip |
[clangd] Ignore semicolons, whitespace, and comments in SelectionTree.
Summary:
Whitespace and comments are a clear bugfix: selecting some
comments/space near a statement doesn't mean you're selecting the
surrounding block.
Semicolons are less obvious, but for similar reasons: these tokens
aren't actually claimed by any AST node (usually), so an AST-based model
like SelectionTree shouldn't take them into account.
Callers may still sometimes care about semis of course:
- when the selection is an expr with a non-expr parent, selection of
the semicolon indicates intent to select the statement.
- when a statement with a trailing semi is selected, we need to know
its range to ensure it can be removed.
SelectionTree may or may not play a role here, but these are separate questions
from its core function of describing which AST nodes were selected.
The mechanism here is the TokenBuffer from syntax-trees. We use it in a
fairly low-level way (just to get boundaries of raw spelled tokens). The
actual mapping of AST nodes to coordinates continues to use the (fairly
mature) SourceLocation based logic. TokenBuffer/Syntax trees
don't currently offer an alternative to getFileRange(), I think.
Reviewers: SureYeaah, kadircet
Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65486
llvm-svn: 367453
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/completion/main.cpp')
0 files changed, 0 insertions, 0 deletions