[PATCH] D18699: [ELF] - Teach linkerscript error handler to show full script line + column marker on error.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 2 11:25:29 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:187-190
@@ +186,6 @@
+std::pair<StringRef, size_t> ScriptParser::getLineColumn() {
+  StringRef Tok = Tokens[Pos == 0 ? 0 : Pos - 1];
+  StringRef Line = getLine(Input, Tok.data() - Input.data());
+  size_t Col = Tok.data() - Line.data() + Tok.size() / 2;
+  return {Line, Col};
+}
----------------
You can directly print out the error messages in this function.

================
Comment at: ELF/LinkerScript.cpp:189
@@ +188,3 @@
+  StringRef Line = getLine(Input, Tok.data() - Input.data());
+  size_t Col = Tok.data() - Line.data() + Tok.size() / 2;
+  return {Line, Col};
----------------
"^" should point to the beginning of an erroneous word instead of middle.


http://reviews.llvm.org/D18699





More information about the llvm-commits mailing list