This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Print output name for command line errors
AbandonedPublic

Authored by evgeny777 on Nov 18 2016, 8:03 AM.

Details

Reviewers
ruiu
rafael
Summary

What I'm trying to do is to simplify processing lld output by automated parsing tool.
Ideally I'd like to have something like this for every warning or error message:

<path_to_ld.lld> : error|warning : <location> : <message>

This makes it easy to extract semantic values from error message and change its format if needed.
For instance MS Visual Studio expects error message in this format:

<location> : error : <message>

And one just needs to swap tokens to get the desired result.

I haven't updated unit tests yet - will do if this patch is a right thing.

Diff Detail

Event Timeline

evgeny777 updated this revision to Diff 78528.Nov 18 2016, 8:03 AM
evgeny777 retitled this revision from to [ELF] Print output name for command line errors.
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: grimar, ikudrin, llvm-commits.
rafael added inline comments.Nov 18 2016, 9:03 AM
ELF/Driver.cpp
99

I am not sure it makes sense to always print the output name. In here the issue has nothing to do with the files, it is just a broken -m option.

If you want a common format, maybe printing something like" <command line>:" in here would be better.

ruiu added inline comments.Nov 18 2016, 9:05 AM
ELF/Driver.cpp
520–523

You can just do

... = getString(Args, OPT_o, "a.out");
evgeny777 added inline comments.Nov 18 2016, 9:17 AM
ELF/Driver.cpp
99

So do you propose to use <command line> as tag for all command line arguments errors?

ruiu edited edge metadata.Nov 18 2016, 10:46 AM

Somewhat related, but I wish we are consistent with the filename+line number format with Clang. I believe this is our current style:

foo.o (143): symbol 'foo' not found

where 143 is a line number. That is different from

foo.o:143: symbol 'foo' not found

which is what clang would format.

Line is not applicable here, I think, so I'm still wondering what's your suggestion for this particular case. I don't mind using clang format for other cases (file:line, without space after ':'). I used round brackets to match file (.section) and file (function_name)

evgeny777 abandoned this revision.Jan 31 2018, 6:55 AM
ruiu added inline comments.Jan 31 2018, 5:09 PM
ELF/Driver.cpp
99

How about showing the error message in this format for command line error for --foo?

error: -m: unknown emulation: xyz