Sirraide wrote:

> One question I have is whether we can also add a helper function for emitting 
> these diagnostics.

I was thinking about that too. My first idea was that if we can rely on the 
order of records in tablegen influencing the order of diagnostic IDs, then one 
idea is to have some `CompatDiag()` function that can be called as 
```c++
CompatDiag(loc, getLangOpts().CPlusPlusXY, diag::compat_cxx_xy_foo)
```
where `CompatDiag()` is basically defined as
```c++
auto Sema::CompatDiag(SourceLocation Loc, bool Std, unsigned DiagId) {
  return Diag(Loc, Std ? DiagId : DiagId + 1);
```
but I’m not sure we can rely on that always doing the right thing.

>  the helper function handles translating that to the getLangOpts() dance with 
> the correct diagnostic.

That would be a bit more involved I think as we’d have to actually modify the 
diagnostics generator, but I think it *should* be possible; I haven’t looked 
into that yet though.

https://github.com/llvm/llvm-project/pull/132129
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to