summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-10-17 06:21:13 +0000
committerJustin Bogner <mail@justinbogner.com>2016-10-17 06:21:13 +0000
commit5424e7c7dc504a5cb12cb71a8b6330471f4e0da6 (patch)
treea641246830f2440f6db9b7dea37e183944a1084e /lld/ELF/ScriptParser.cpp
parent812101d86204a5fa8a2499cc541d1a1185100996 (diff)
downloadbcm5719-llvm-5424e7c7dc504a5cb12cb71a8b6330471f4e0da6.tar.gz
bcm5719-llvm-5424e7c7dc504a5cb12cb71a8b6330471f4e0da6.zip
ELF: Add a skip() overload to ignore any token
Most functions that return StringRef should check their return values, so I'm planning on marking StringRef [[nodiscard]]. This requires splitting up functions like next() that are sometimes just used for side effects. llvm-svn: 284363
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 97d68d92318..63c8d5a4ffc 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -150,6 +150,16 @@ bool ScriptParserBase::skip(StringRef Tok) {
return true;
}
+void ScriptParserBase::skip() {
+ if (Error)
+ return;
+ if (atEOF()) {
+ setError("unexpected EOF");
+ return;
+ }
+ ++Pos;
+}
+
void ScriptParserBase::expect(StringRef Expect) {
if (Error)
return;
OpenPOWER on IntegriCloud