[clang] [Clang] Fix FixIt for implicit-int diagnostics. (PR #179356)

Karl Friebel via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 9 04:54:08 PST 2026


KFAFSP wrote:

> I feel like a better fix would be to emit the warning only once per decl group

I was also thinking that. However, I decided against it, because it is a way more invasive change. It change the number of diagnostics emitted, and thus the observed output for every user. It is easy to implement though, I believe. 

Note that this diagnostic is an error and not a warning for newer C standards and C++. There is also the option of demoting every subsequent error in the decl group to a warning and thus side-step the need to generate fix-its for them... But that is also invasive and might need a new diagnostic ID? The existing warning can't appear for the language standards where this is an error, people might rely on that.

> `FixItHint::CreateInsertion("")` is a bit horrible candidly.

This is also what was frustrating to me. However, I think a "do nothing" fix is not that far-fetched, but there isn't a canonical one, unfortunately. Considering fixits don't provide a guarantee anyways and the code is checked again afterwards. 

https://github.com/llvm/llvm-project/pull/179356


More information about the cfe-commits mailing list