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());
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());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits