diff options
author | Rui Ueyama <ruiu@google.com> | 2016-04-23 00:04:03 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-04-23 00:04:03 +0000 |
commit | 9c1112d09a7a2e62e7363c4fc46c26428011712c (patch) | |
tree | c887cbb8334b9e3f923328d6fd0e0c3a3b9ef163 /lld/ELF/ScriptParser.cpp | |
parent | 5142c0d7fa8aecf32b4b202798a20d9c65ae18ce (diff) | |
download | llvm-9c1112d09a7a2e62e7363c4fc46c26428011712c.zip llvm-9c1112d09a7a2e62e7363c4fc46c26428011712c.tar.gz llvm-9c1112d09a7a2e62e7363c4fc46c26428011712c.tar.bz2 |
Use ScriptParserBase features to parse linker script expressions.
Previously, we have re-implemented utility functions such as `expect`
or `next` in LinkerScript.cpp. This patch reuses the existing
implementation that is in ScriptParser.cpp.
llvm-svn: 267255
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 8 |
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; } |