This is an archive of the discontinued LLVM Phabricator instance.

[lld] reformat multi-line error messages in source code
AbandonedPublic

Authored by thakis on Apr 22 2021, 8:12 AM.

Details

Reviewers
MaskRay
int3
Group Reviewers
Restricted Project
Summary

This reformats multi-line error messages to look more alike when
printed and in source code. (It does _not_ modify lld's output, it
just changes how the code looks.)

I think this looks nicer. The drawback is that clang-format insists on putting
the "\n" on its own line. Maybe this not being clang-format-compliant is fine
and the increase in readability is worth it, or maybe the increase in
readability is too small to make up for the annoyance of clang-format not Just
Working. I kind of like how this looks right now, but I can also see the
drawback. Sending this out, and unless everyone thinks this is good, then let's
not land it :) (I'll wait for comments for a week or so.)

Also make an /lldmap warning not use the >>> style since it seems
inappropriate there. No other behavior change.

Diff Detail

Event Timeline

thakis created this revision.Apr 22 2021, 8:12 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
thakis requested review of this revision.Apr 22 2021, 8:12 AM
int3 added a comment.Apr 22 2021, 1:53 PM

Hm, I'd prefer not to have to see spurious clang-format messages.

It also means that I can't just clang-format -i the entire directory any more. I know there's clang-format-diff, but sometimes cleaning up the whole directory is what's needed...

How about introducing a multilineError function that takes multiple string parameters instead and adds the appropriate \n and >>> bits?

Hm, I'd prefer not to have to see spurious clang-format messages.

It also means that I can't just clang-format -i the entire directory any more. I know there's clang-format-diff, but sometimes cleaning up the whole directory is what's needed...

How about introducing a multilineError function that takes multiple string parameters instead and adds the appropriate \n and >>> bits?

+1 my $0.02, I'd personally prefer the code to be in a state where running clang-format in a clean checkout does not change anything.
Otherwise, any change made to such code could potentially lead to spurious formatting changes, which is a bit annoying.

thakis abandoned this revision.Apr 24 2021, 9:23 AM

A'ight, thanks for humoring me :)

As-is is pretty good.