[PATCH] D87409: [libTooling] Fix use of `char` in comparison.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 12:14:07 PDT 2020
ymandel created this revision.
ymandel added a reviewer: lbenes.
Herald added a project: clang.
ymandel requested review of this revision.
Fixes Transformer's `Range` parser to handle `char` in a platform-independent way.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87409
Files:
clang/lib/Tooling/Transformer/Parsing.cpp
Index: clang/lib/Tooling/Transformer/Parsing.cpp
===================================================================
--- clang/lib/Tooling/Transformer/Parsing.cpp
+++ clang/lib/Tooling/Transformer/Parsing.cpp
@@ -148,7 +148,7 @@
}
static StringRef consumeWhitespace(StringRef S) {
- return S.drop_while([](char c) { return c >= 0 && isWhitespace(c); });
+ return S.drop_while([](char c) { return isASCII(c) && isWhitespace(c); });
}
// Parses a single expected character \c c from \c State, skipping preceding
@@ -165,7 +165,7 @@
static ExpectedProgress<std::string> parseId(ParseState State) {
State.Input = consumeWhitespace(State.Input);
auto Id = State.Input.take_while(
- [](char c) { return c >= 0 && isIdentifierBody(c); });
+ [](char c) { return isASCII(c) && isIdentifierBody(c); });
if (Id.empty())
return makeParseError(State, "failed to parse name");
return makeParseProgress(advance(State, Id.size()), Id.str());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87409.290792.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200909/c50e22b1/attachment.bin>
More information about the cfe-commits
mailing list