[cfe-dev] Determine CUDA qualifiers in AST

Peter Collingbourne peter at pcc.me.uk
Wed Jun 15 10:24:05 PDT 2011


On Wed, Jun 15, 2011 at 10:54:32AM +0000, Felix Schmitt wrote:
> Hi everbody,
> 
> I am currently working on CUDA source-to-source transformations using clang
> version 3.0 (trunk 132310).
> 
> I understand from the sources that there is support for CUDA qualifiers such as
> __global__, __shared__ etc. However, I don't know how to find out for example
> which functions have the __global__ qualifiers attached.

Hi Felix,

The __global__, __shared__ etc. qualifiers are represented as
declaration attributes.  You can test for the presence of attributes
using the Decl::hasAttr function.  For example:

if (FD->hasAttr<CUDAGlobalAttr>()) {
  ...
}

Thanks,
-- 
Peter



More information about the cfe-dev mailing list