[ELF] Print file:line for 'undefined section' errors

Differential revision: https://reviews.llvm.org/D27108

llvm-svn: 288019
This commit is contained in:
Eugene Leviant
2016-11-28 09:58:04 +00:00
parent 0f0d5d8f8d
commit ed30ce7ae4
6 changed files with 26 additions and 12 deletions

View File

@@ -172,6 +172,13 @@ void ScriptParserBase::expect(StringRef Expect) {
setError(Expect + " expected, but got " + Tok);
}
std::string ScriptParserBase::currentLocation() {
MemoryBufferRef MB = currentBuffer();
return (MB.getBufferIdentifier() + ":" +
Twine(getPos(MB.getBuffer(), Tokens[Pos - 1]).first))
.str();
}
// Returns true if string 'Bigger' contains string 'Shorter'.
static bool containsString(StringRef Bigger, StringRef Shorter) {
const char *BiggerEnd = Bigger.data() + Bigger.size();