[PATCH] D37015: [ELF] - Do not report multiple errors for single one in ScriptLexer::setError.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 01:49:43 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311537: [ELF] - Do not report multiple errors for single one in ScriptLexer::setError. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D37015?vs=112192&id=112310#toc
Repository:
rL LLVM
https://reviews.llvm.org/D37015
Files:
lld/trunk/ELF/ScriptLexer.cpp
lld/trunk/test/ELF/linkerscript/diagnostic.s
lld/trunk/test/ELF/linkerscript/linkerscript.s
Index: lld/trunk/test/ELF/linkerscript/linkerscript.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/linkerscript.s
+++ lld/trunk/test/ELF/linkerscript/linkerscript.s
@@ -38,7 +38,7 @@
# RUN: not ld.lld %t.script > %t.log 2>&1
# RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log
# INCLUDE_ERR: error: {{.+}}.script:1: cannot open foo.script
-# INCLUDE_ERR-NEXT: error: {{.+}}.script:1: INCLUDE "foo.script"
+# INCLUDE_ERR-NEXT: INCLUDE "foo.script"
# RUN: ld.lld -L %T %t.script %t
# RUN: echo "FOO(BAR)" > %t.script
Index: lld/trunk/test/ELF/linkerscript/diagnostic.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/diagnostic.s
+++ lld/trunk/test/ELF/linkerscript/diagnostic.s
@@ -50,9 +50,9 @@
# RUN: echo ".temp : { *(.temp) } }" >> %t.script
# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | \
# RUN: FileCheck -check-prefix=ERR6 -strict-whitespace %s
-# ERR6: error: {{.*}}.script:1:
-# ERR6-NEXT: error: {{.*}}.script:1: UNKNOWN_TAG {
-# ERR6-NEXT: error: {{.*}}.script:1: ^
+# ERR6: error: {{.*}}.script:1: unknown directive: UNKNOWN_TAG
+# ERR6-NEXT: >>> UNKNOWN_TAG {
+# ERR6-NEXT: >>> ^
## One more check that text of lines and pointer to 'bad' token are working ok.
# RUN: echo "SECTIONS {" > %t.script
@@ -62,8 +62,8 @@
# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | \
# RUN: FileCheck -check-prefix=ERR7 -strict-whitespace %s
# ERR7: error: {{.*}}.script:4: malformed number: .temp
-# ERR7-NEXT: error: {{.*}}.script:4: boom .temp : { *(.temp) } }
-# ERR7-NEXT: error: {{.*}}.script:4: ^
+# ERR7-NEXT: >>> boom .temp : { *(.temp) } }
+# ERR7-NEXT: >>> ^
## Check tokenize() error
# RUN: echo "SECTIONS {}" > %t.script
@@ -89,8 +89,8 @@
# RUN: not ld.lld -shared %t -o %t1 --script %t.script 2>&1 | \
# RUN: FileCheck -check-prefix=ERR10 -strict-whitespace %s
# ERR10: error: {{.*}}.script.inc:4: malformed number: .temp
-# ERR10-NEXT: error: {{.*}}.script.inc:4: boom .temp : { *(.temp) } }
-# ERR10-NEXT: error: {{.*}}.script.inc:4: ^
+# ERR10-NEXT: >>> boom .temp : { *(.temp) } }
+# ERR10-NEXT: >>> ^
## Check error reporting in script with INCLUDE directive.
# RUN: echo "SECTIONS {" > %t.script.inc
Index: lld/trunk/ELF/ScriptLexer.cpp
===================================================================
--- lld/trunk/ELF/ScriptLexer.cpp
+++ lld/trunk/ELF/ScriptLexer.cpp
@@ -78,15 +78,11 @@
if (ErrorCount)
return;
- if (!Pos) {
- error(getCurrentLocation() + ": " + Msg);
- return;
- }
-
- std::string S = getCurrentLocation() + ": ";
- error(S + Msg);
- error(S + getLine());
- error(S + std::string(getColumnNumber(), ' ') + "^");
+ std::string S = (getCurrentLocation() + ": " + Msg).str();
+ if (Pos)
+ S += "\n>>> " + getLine().str() + "\n>>> " +
+ std::string(getColumnNumber(), ' ') + "^";
+ error(S);
}
// Split S into linker script tokens.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37015.112310.patch
Type: text/x-patch
Size: 3027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170823/5c9d303f/attachment.bin>
More information about the llvm-commits
mailing list