[cfe-dev] clang frontend for cuda files.

Eli Friedman eli.friedman at gmail.com
Thu Jul 30 12:15:20 PDT 2009

On Thu, Jul 30, 2009 at 11:10 AM, Michal<korgulec at gmail.com> wrote:
> Hi,
> I would like to be able to get AST of kernels written in CUDA, this is
> mainly C with simple templates (no metaprogramming, templates are
> usualy compile-time arguments to functions). Is clang C++ front end
> able to parse such files? Examples can be found at
> http://gpgpu.org/developer/cudpp or
> http://www.nvidia.com/object/cuda_get.html (choose cuda sdk).
> Of course there are some additional reserved keywords, so clang wont
> work out of the box, but that isn't the main problem.

I don't see any fundamental difficultly with making clang compile such
files; of course, we don't have support for CUDA-specific constructs
at the moment, but we'd be willing to integrate such support if
someone wanted to contribute it.

clang C++ support is relatively immature, so you might run into issues
with that, but clang should be able to parse code that isn't too
complicated and doesn't use the STL.  I'd suggest trying it with the
code you're looking at to see what sorts of errors you get.  I
wouldn't suggest using code generation for C++, since it's still
extremely immature, but that doesn't seem important to you.  See
http://clang.llvm.org/cxx_status.html for more details.


More information about the cfe-dev mailing list