[clang] 22f8125 - [Tooling/Syntax] Helpers to find spelled tokens touching a location.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 13 07:57:14 PST 2019
Author: Sam McCall
Date: 2019-12-13T16:57:03+01:00
New Revision: 22f81250889b2e366187ee1465ba0ec71a6e457d
URL: https://github.com/llvm/llvm-project/commit/22f81250889b2e366187ee1465ba0ec71a6e457d
DIFF: https://github.com/llvm/llvm-project/commit/22f81250889b2e366187ee1465ba0ec71a6e457d.diff
LOG: [Tooling/Syntax] Helpers to find spelled tokens touching a location.
Summary: Useful when positions are used to target nodes, with before/after ambiguity.
Reviewers: ilya-biryukov, kbobyrev
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71356
Added:
Modified:
clang/lib/Tooling/Syntax/Tokens.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/Syntax/Tokens.cpp b/clang/lib/Tooling/Syntax/Tokens.cpp
index 7c7a442dff03..96595826ddb7 100644
--- a/clang/lib/Tooling/Syntax/Tokens.cpp
+++ b/clang/lib/Tooling/Syntax/Tokens.cpp
@@ -254,7 +254,6 @@ syntax::spelledTokensTouching(SourceLocation Loc,
assert(Loc.isFileID());
llvm::ArrayRef<syntax::Token> All =
Tokens.spelledTokens(Tokens.sourceManager().getFileID(Loc));
- // Comparing SourceLocations is well-defined within a FileID.
auto *Right = llvm::partition_point(
All, [&](const syntax::Token &Tok) { return Tok.location() < Loc; });
bool AcceptRight = Right != All.end() && Right->location() <= Loc;
More information about the cfe-commits
mailing list