[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 12:51:29 PDT 2016


rnk added inline comments.


> jlebar wrote in Sema.h:9258
> These diagnostics live until the end of codegen, and so are destroyed after the ASTContext.
> 
> I am becoming increasingly displeased with emitting these errors during codegen.  In particular, it makes it annoying to write tests.  You cannot test deferred and immediate errors in the same test, because if you have any immediate errors, we never codegen, so we never emit the deferred ones.  This will also be a suboptimal user experience.
> 
> The only serious alternative mooted thus far is emitting the deferred errors when a function is marked used.  But this is going to emit deferred errors if e.g. two inline host+device functions have mutual recursion but are otherwise never touched (so don't need to be codegen'ed).  I am not sure if this will be OK or not, but I need to look at it.
> 
> If we move the errors to being emitted earlier, we won't need to do this dance.

The ASTContext should outlive IRgen, since the AST is allocated in its arena. Is there a separate diagnostic memory pool that I don't know about?

https://reviews.llvm.org/D25139





More information about the cfe-commits mailing list