[PATCH] D84300: [LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 22 02:53:10 PDT 2020
grimar created this revision.
grimar added reviewers: MaskRay, psmith.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Currently we print "error: unclosed comment in a linker script", which doesn't provide an
information about real error location.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46793.
https://reviews.llvm.org/D84300
Files:
lld/ELF/ScriptLexer.cpp
lld/ELF/ScriptLexer.h
lld/test/ELF/linkerscript/diag6.test
Index: lld/test/ELF/linkerscript/diag6.test
===================================================================
--- lld/test/ELF/linkerscript/diag6.test
+++ lld/test/ELF/linkerscript/diag6.test
@@ -4,4 +4,4 @@
SECTIONS /*
-CHECK: error: unclosed comment in a linker script
+CHECK: error: {{.*}}diag6.test:1: unclosed comment in a linker script
Index: lld/ELF/ScriptLexer.h
===================================================================
--- lld/ELF/ScriptLexer.h
+++ lld/ELF/ScriptLexer.h
@@ -24,7 +24,7 @@
void setError(const Twine &msg);
void tokenize(MemoryBufferRef mb);
- static StringRef skipSpace(StringRef s);
+ StringRef skipSpace(StringRef s);
bool atEOF();
StringRef next();
StringRef peek();
Index: lld/ELF/ScriptLexer.cpp
===================================================================
--- lld/ELF/ScriptLexer.cpp
+++ lld/ELF/ScriptLexer.cpp
@@ -146,7 +146,7 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84300.279742.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/b2ea4edf/attachment.bin>
More information about the llvm-commits
mailing list