This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Refactor file I/O error messages
AbandonedPublic

Authored by evgeny777 on Nov 25 2016, 5:49 AM.

Details

Reviewers
ruiu
rafael
Summary

Change position of file name to conform current style.

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 79298.Nov 25 2016, 5:49 AM
evgeny777 retitled this revision from to [ELF] Refactor file I/O error messages.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: ikudrin, grimar, llvm-commits.
ruiu edited edge metadata.Nov 25 2016, 8:19 AM

I honestly don't think it is an improvement to change this message

error: cannot open foo.o: no such file

to

error: foo.o: cannot open: no such file

because the latter doesn't make sense as a sentence. Why do you want to change that?

Like I said earlier, I'd like to have the same format for error messages, so it's easier to parse and change format, when needed.
Those messages have ':' after 'cannot open <file>', which makes the above impossible. Do you have some idea on how to fix this?

ruiu added a comment.Nov 25 2016, 8:47 AM

A <file> in "cannot open <file>" is not a location where an error occurred. It's just a result of an error and an error location is somewhere else. For example, imagine that you have a linker script with an INPUT(<file>) command. If we fail to open that file, we want to print out something like this.

error: <linker-script>:308: cannot open <file>: no such file

instead of

error: <file>: cannot open: no such file

So, filename in this case does not indicate where an error happened. We should print out a location that made us open that file instead.

evgeny777 abandoned this revision.Nov 28 2016, 2:00 AM