[LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error.

Currently we print "error: unclosed comment in a linker script", which doesn't
provide information about the real error location.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46793.

Differential revision: https://reviews.llvm.org/D84300
This commit is contained in:
Georgii Rymar 2020-07-22 12:48:16 +03:00
parent 0e1a42efd8
commit ae4279bd3e
3 changed files with 3 additions and 3 deletions

View File

@ -146,7 +146,7 @@ StringRef ScriptLexer::skipSpace(StringRef s) {
if (s.startswith("/*")) {
size_t e = s.find("*/", 2);
if (e == StringRef::npos) {
error("unclosed comment in a linker script");
setError("unclosed comment in a linker script");
return "";
}
s = s.substr(e + 2);

View File

@ -24,7 +24,7 @@ public:
void setError(const Twine &msg);
void tokenize(MemoryBufferRef mb);
static StringRef skipSpace(StringRef s);
StringRef skipSpace(StringRef s);
bool atEOF();
StringRef next();
StringRef peek();

View File

@ -4,4 +4,4 @@
SECTIONS /*
CHECK: error: unclosed comment in a linker script
CHECK: error: {{.*}}diag6.test:1: unclosed comment in a linker script