[PATCH] D76512: [YAMLParser] Scanner::setError - ensure we use the StringRef::iterator argument (PR45043)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 11:20:58 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG22257975679d: [YAMLParser] Scanner::setError - ensure we use the StringRef::iterator argument… (authored by RKSimon).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76512/new/
https://reviews.llvm.org/D76512
Files:
llvm/lib/Support/YAMLParser.cpp
Index: llvm/lib/Support/YAMLParser.cpp
===================================================================
--- llvm/lib/Support/YAMLParser.cpp
+++ llvm/lib/Support/YAMLParser.cpp
@@ -268,8 +268,8 @@
}
void setError(const Twine &Message, StringRef::iterator Position) {
- if (Current >= End)
- Current = End - 1;
+ if (Position >= End)
+ Position = End - 1;
// propagate the error if possible
if (EC)
@@ -278,14 +278,10 @@
// Don't print out more errors after the first one we encounter. The rest
// are just the result of the first, and have no meaning.
if (!Failed)
- printError(SMLoc::getFromPointer(Current), SourceMgr::DK_Error, Message);
+ printError(SMLoc::getFromPointer(Position), SourceMgr::DK_Error, Message);
Failed = true;
}
- void setError(const Twine &Message) {
- setError(Message, Current);
- }
-
/// Returns true if an error occurred while parsing.
bool failed() {
return Failed;
@@ -934,13 +930,13 @@
bool Scanner::consume(uint32_t Expected) {
if (Expected >= 0x80) {
- setError("Cannot consume non-ascii characters");
+ setError("Cannot consume non-ascii characters", Current);
return false;
}
if (Current == End)
return false;
if (uint8_t(*Current) >= 0x80) {
- setError("Cannot consume non-ascii characters");
+ setError("Cannot consume non-ascii characters", Current);
return false;
}
if (uint8_t(*Current) == Expected) {
@@ -1763,7 +1759,7 @@
&& !isBlankOrBreak(Current + 2)))
return scanPlainScalar();
- setError("Unrecognized character while tokenizing.");
+ setError("Unrecognized character while tokenizing.", Current);
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76512.254866.patch
Type: text/x-patch
Size: 1736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200403/dc9e1b99/attachment.bin>
More information about the llvm-commits
mailing list