[PATCH] D27506: [ELF] - Print absolute file name in errors when possible.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 09:25:00 PST 2016


ruiu added a comment.

LGTM



================
Comment at: ELF/InputFiles.cpp:95
+  std::string Ret = Info.FileName + ":" + std::to_string(Info.Line);
+#ifdef LLVM_ON_WIN32
+  // Converts path to use unix path separators so error message is
----------------
grimar wrote:
> ruiu wrote:
> > grimar wrote:
> > > ruiu wrote:
> > > > Add a blank line before #ifdef.
> > > I am going to export convertToUnixPathSeparator from \llvm\tools\lld\lib\Core\Reproduce.cpp as was requested by Rafael and use it here instead.
> > OK, but if it involves packing into SmallString and unpack it to std::string, it would be uglier than this, so please upload a patch after you make a change. Thanks.
> It did not involve packing/unpacking..
Use `Ret.data()` instead of `&Ret[0]` because the latter is invalid if Ret is empty. (That shouldn't happen in this case, but always avoiding `&Ret[0]` is a good idea.)


https://reviews.llvm.org/D27506





More information about the llvm-commits mailing list