This is an archive of the discontinued LLVM Phabricator instance.

win: Omit ".exe" from lld warning and error messages.
ClosedPublic

Authored by thakis on Aug 22 2018, 3:41 PM.

Details

Summary

This is a minor follow-up to https://reviews.llvm.org/D49189. On Windows, lld used to print "lld-link.exe: error: ...". Now it just prints "lld-link: error: ...". This matches what link.exe does (it prints "LINK : ...") and makes lld's output less dependent on the host system.

Diff Detail

Event Timeline

thakis created this revision.Aug 22 2018, 3:41 PM
thakis updated this revision to Diff 162077.Aug 22 2018, 3:42 PM
ruiu added a comment.Aug 22 2018, 3:55 PM

It looks like this patch uses the knowledge of the default filename of the lld executable for each target, but what we want to do is simple: strip ".exe" from the end of the string if exists. So maybe we should create stripExe function or something?

lld/ELF/Driver.cpp
77–80

I believe you need case-insensitive comparison.

thakis updated this revision to Diff 162093.Aug 22 2018, 4:11 PM

Thanks, that's a good suggestion. I put the new function in Common/Args.h; I'm not sure if that's the best place.

ruiu accepted this revision.Aug 22 2018, 4:32 PM

LGTM

lld/Common/Args.cpp
69 ↗(On Diff #162093)

path -> Path

70 ↗(On Diff #162093)

This can be Path.endswith_lower(".exe").

This revision is now accepted and ready to land.Aug 22 2018, 4:32 PM
thakis closed this revision.Aug 22 2018, 4:53 PM

r340487, thanks!

grimar added a subscriber: grimar.Aug 23 2018, 2:00 AM
grimar added inline comments.
lld/Common/Args.cpp
69 ↗(On Diff #162093)

Should not function name start from the lower case? I would also add get prefix: getFilenameWithoutExe.
This would be consistent with other functions around at least.

thakis marked an inline comment as done.Apr 24 2019, 5:50 AM
thakis added inline comments.
lld/Common/Args.cpp
69 ↗(On Diff #162093)

Sorry, I didn't see this for a few months. Looks like Rui took care for it in http://reviews.llvm.org/rL340716 though. Thanks!

Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2019, 5:50 AM
Herald added a subscriber: MaskRay. · View Herald Transcript