summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 79f3cd38646..474895fe133 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -156,11 +156,14 @@ StringRef ScriptParserBase::next() {
return Tokens[Pos++];
}
-StringRef ScriptParserBase::peek() {
- StringRef Tok = next();
- if (Error)
- return "";
- --Pos;
+StringRef ScriptParserBase::peek(unsigned N) {
+ StringRef Tok;
+ for (unsigned I = 0; I <= N; ++I) {
+ Tok = next();
+ if (Error)
+ return "";
+ }
+ Pos = Pos - N - 1;
return Tok;
}
OpenPOWER on IntegriCloud