[lld] r336651 - [ELF] - Improve call graph pasing error reporting.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 10 03:28:55 PDT 2018
Author: grimar
Date: Tue Jul 10 03:28:55 2018
New Revision: 336651
URL: http://llvm.org/viewvc/llvm-project?rev=336651&view=rev
Log:
[ELF] - Improve call graph pasing error reporting.
This adds a file name to the error message,
adds a missing test case and refactors code a bit.
Added:
lld/trunk/test/ELF/cgprofile-err.s
Modified:
lld/trunk/ELF/Driver.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=336651&r1=336650&r2=336651&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Jul 10 03:28:55 2018
@@ -631,11 +631,9 @@ static void readCallGraph(MemoryBufferRe
for (StringRef L : args::getLines(MB)) {
SmallVector<StringRef, 3> Fields;
L.split(Fields, ' ');
- if (Fields.size() != 3)
- fatal("parse error");
uint64_t Count;
- if (!to_integer(Fields[2], Count))
- fatal("parse error");
+ if (Fields.size() != 3 || !to_integer(Fields[2], Count))
+ fatal(MB.getBufferIdentifier() + ": parse error");
const Symbol *FromSym = SymbolNameToSymbol.lookup(Fields[0]);
const Symbol *ToSym = SymbolNameToSymbol.lookup(Fields[1]);
if (Config->WarnSymbolOrdering) {
Added: lld/trunk/test/ELF/cgprofile-err.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/cgprofile-err.s?rev=336651&view=auto
==============================================================================
--- lld/trunk/test/ELF/cgprofile-err.s (added)
+++ lld/trunk/test/ELF/cgprofile-err.s Tue Jul 10 03:28:55 2018
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+# RUN: echo "A B C 100" > %t.call_graph
+# RUN: not ld.lld %t --call-graph-ordering-file \
+# RUN: %t.call_graph -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK: {{.*}}.call_graph: parse error
+
+# RUN: echo "A B C" > %t.call_graph
+# RUN: not ld.lld %t --call-graph-ordering-file \
+# RUN: %t.call_graph -o /dev/null 2>&1 | FileCheck %s
More information about the llvm-commits
mailing list