rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.
Comment at: clang/include/clang/Sema/Sema.h:9238
+ /// if (CUDADiagBuilder(...) << foo << bar)
+ /// return ExprError();
> rnk wrote:
> > I'm concerned that this usage pattern isn't going to be efficient because
> > you build the complete diagnostic before calling the bool conversion
> > operator to determine that it doesn't need to be emitted. I think you want
> > to construct something more like:
> > if (isCUDADeviceCode())
> > CUDADiag(...) << ...;
> > Otherwise you are going to construct and destruct a large number of
> > diagnostics about language features that are forbidden in device code, but
> > are legal in host code, and 99% of the TU is going to be host code that
> > uses these illegal features.
> I think the comment is misleading -- I tried to update it to resolve this
> misunderstanding. Does it make more sense now?
Actually, I just had to think about the problem more to realize why it has to
be this way. This is for deferred diagnostics where you don't know if the code
is device code yet. :)
cfe-commits mailing list