aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index b8d3a78..2bc0bbc 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -43,8 +43,12 @@ void ScriptParserBase::printErrorPos() {
void ScriptParserBase::setError(const Twine &Msg) {
if (Error)
return;
- error("line " + Twine(getPos()) + ": " + Msg);
- printErrorPos();
+ if (Input.empty()) {
+ error(Msg);
+ } else {
+ error("line " + Twine(getPos()) + ": " + Msg);
+ printErrorPos();
+ }
Error = true;
}