[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked an inline comment as done. ilya-biryukov added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:270 + for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens)) +if (Tok.kind() == tok::identifier) + return &Tok;

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. sammccall marked 2 inline comments as done. Closed by commit rG3f8da5d09107: [Tooling/Syntax] Helpers to find spelled tokens touching a location. (authored by sammccall). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall marked 6 inline comments as done. sammccall added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:261 + bool AcceptRight = Right != All.end() && !(Loc < Right->location()); + bool AcceptLeft = Right != All.begin() && !((Right - 1)->endLocation() < Lo

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 60699 tests passed, 0 failed and 726 were skipped. {icon check-circle color=green} clang-format: pass. Build artifacts : console-log.txt

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:270 + for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens)) +if (Tok.kind() == tok::identifier) + return &Tok; kbobyrev wrote: > ilya-biryukov wrote: > >

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked an inline comment as done. ilya-biryukov added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:261 + bool AcceptRight = Right != All.end() && !(Loc < Right->location()); + bool AcceptLeft = Right != All.begin() && !((Right - 1)->endLocation

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:270 + for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens)) +if (Tok.kind() == tok::identifier) + return &Tok; ilya-biryukov wrote: > sammccall wrote: > > ilya

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 60699 tests passed, 0 failed and 726 were skipped. {icon check-circle color=green} clang-format: pass. Build artifacts : console-log.txt

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:320 +const syntax::Token * +spelledIdentifierTouching(SourceLocation Loc, + const syntax::TokenBuffer &Tokens); kbobyrev wrote: > sammccall wrote: >

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 233557. sammccall marked 10 inline comments as done. sammccall added a comment. braces Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71356/new/ https://reviews.llvm.org/D71356 Files: clang/include/clang/Ba

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 233550. sammccall added a comment. Add overloads for SourceLocation comparison, and document when they're meaningful. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71356/new/ https://reviews.llvm.org/D71356

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:260 + All, [&](const syntax::Token &Tok) { return Tok.location() < Loc; }); + bool AcceptRight = Right != All.end() && !(Loc < Right->location()); + bool AcceptLeft = Right != All.begin() && !(

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:260 + All, [&](const syntax::Token &Tok) { return Tok.location() < Loc; }); + bool AcceptRight = Right != All.end() && !(Loc < Right->location()); + bool AcceptLeft = Right != All.begin()

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:270 + for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens)) +if (Tok.kind() == tok::identifier) + return &Tok; NIT: add braces around `if` statement Rep

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev marked an inline comment as done. kbobyrev added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:320 +const syntax::Token * +spelledIdentifierTouching(SourceLocation Loc, + const syntax::TokenBuffer &Tokens);

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 60699 tests passed, 0 failed and 726 were skipped. {icon check-circle color=green} clang-format: pass. Build artifacts : console-log.txt

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 233415. sammccall marked 6 inline comments as done. sammccall added a comment. comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71356/new/ https://reviews.llvm.org/D71356 Files: clang/include/clang/T

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:320 +const syntax::Token * +spelledIdentifierTouching(SourceLocation Loc, + const syntax::TokenBuffer &Tokens); kbobyrev wrote: > Maybe `llvm::Option

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:320 +const syntax::Token * +spelledIdentifierTouching(SourceLocation Loc, + const syntax::TokenBuffer &Tokens); Maybe `llvm::Optional<>` here? =

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 60699 tests passed, 0 failed and 726 were skipped. {icon times-circle color=red} clang-format: fail. Please format your changes with clang-format by running `git-clang-format HEAD^` or apply this patch

[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision. sammccall added reviewers: ilya-biryukov, kbobyrev. Herald added a project: clang. Herald added a subscriber: cfe-commits. Useful when positions are used to target nodes, with before/after ambiguity. Repository: rG LLVM Github Monorepo https://reviews.llvm.org