AaronBallman wrote:

> I don’t think there is a good way to deal w/ custom diag ids. Those 
> _shouldn’t_ be used anywhere in Clang anyway (I know there are a few places 
> that use them, but those should all be updated to use proper diagnostics 
> instead).

+1, those custom diagnostics should be using real diagnostics instead.

> Should we automatically strip the prefix when generating the stable ID 
> (either in the SARIF emitter, or in tablegen)?

I think we may want an actual mapping instead; the problem is, we want the 
ability to rename any part of the diagnostic identifier because it is most 
readable when it matches the text of the diagnostic to some extent. The prefix 
happens to be something we change somewhat often as an example. But we 
sometimes reword diagnostics either because the diagnostic is now being used 
for more circumstances or because someone just found much better phrasing and 
it would be bad if our "stable" IDs either 1) weren't actually stable, or 2) 
were stable but prevented us from improving maintenance costs. In the PR 
summary you discuss this a bit with an idea of how we could improve it in the 
future, but I think that's going to be a problem sooner rather than later and 
we could consider addressing it up front.

Because these IDs are not being exposed to the user (either documented on a 
webpage, displayed as part of the diagnostic text to the user, etc), should we 
auto-generate a UUID for the diagnostic entries which don't have one already 
associated with them yet (which is all of them at first), and use that as the 
stable ID? Then it doesn't matter how the diagnostic changes, the underlying 
UUID is still the same. I'm not certain of how we would persist this across 
builds, though, so it might be a terrible idea. But I'm hoping we can find 
something that 1) doesn't require the developer to manually pick an ID and put 
it in the .td file, 2) allows us to modify anything about the diagnostic we 
want without impacting the stable ID. WDYT?

https://github.com/llvm/llvm-project/pull/168153
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to