This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Use shorter, more recognizable codes for diagnostics.
ClosedPublic

Authored by sammccall on Apr 17 2019, 6:29 AM.

Details

Summary
  • for warnings, use "foo" if the warning is controlled by -Wfoo
  • for errors, keep using the internal name (there's nothing better) but drop the err_ prefix

This comes at the cost of uniformity, it's no longer totally obvious
exactly what the code field contains. But the -Wname flags are so much
more useful to end-users than the internal warn_foo that this seems worth it.

Diff Detail

Event Timeline

sammccall created this revision.Apr 17 2019, 6:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2019, 6:29 AM
kadircet accepted this revision.Apr 17 2019, 7:02 AM

I agree that these are more useful. What about also adding "-W" in front of warning flags to make them more explicit and stand out from "non-flag" error names?

This revision is now accepted and ready to land.Apr 17 2019, 7:02 AM
sammccall updated this revision to Diff 195623.Apr 17 2019, 1:03 PM

-Wfoo instead of foo

I agree that these are more useful. What about also adding "-W" in front of warning flags to make them more explicit and stand out from "non-flag" error names?

I went back and forth on this, I think you're probably right. It's consistent with how clang-tidy check names vs warnings are exposed to users: "Diag text [-Wfoo]" and "Diag text [check-name]".
Let's see how it goes.

This revision was automatically updated to reflect the committed changes.