[PATCH] D150718: [CUDA] Relax restrictions on GPU-side variadic functions

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 10:33:50 PDT 2023


tra added a comment.

In D150718#4348737 <https://reviews.llvm.org/D150718#4348737>, @jlebar wrote:

> This seems a little dangerous -- we're saying the frontend will accept this but we can't generate code for it?  What happens if we try to generate code?  Do we get some sort of error, or do we silently fail?

This will allow generation of variadic functions, as long as they do not use va_arg (in other words, as long as they do not access the variadic arguments).
It's safe to do now, because NVPTX backend already has variadics support

In case va_arg is encountered, clang will produce correct diagnostics and it is already covered by test/SemaCUDA/vararg.cu

In D150718#4349747 <https://reviews.llvm.org/D150718#4349747>, @yaxunl wrote:

> could make the diagnostic about variadic functions a deferred diagnostic, then the diag will only be emitted if the function is really emitted.

The short-term need is only for being able to parse variadic function declarations. Being able to emit some of them is nice, but not useful in practice. No point blocking the ones we can emit, but there's not much benefit in extending that set with deferred diags either.

I do plan to enable full support for variadics soon, anyways.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150718/new/

https://reviews.llvm.org/D150718



More information about the cfe-commits mailing list