<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 5, 2014 at 4:12 AM, jotas <span dir="ltr"><<a href="mailto:julian.maciejewski@gmail.com" target="_blank">julian.maciejewski@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
I ma building rewriter based on clang (based on some tutorial available on<br>
the internet).<br>
I am loading CUDA file and trying to traverse AST. I got a problem. It<br>
doesn't recognize CUDA directives like __global__ etc.<br>
I set:<br>
TheCompInst.getLangOpts().CUDA = 1;<br>
and source search patch to:<br>
/usr/include/linux<br>
<br>
Sould I do someting more?<br>
<br>
I get an error:<br>
<br>
:~/Documents/rewriter$ ./rewritersample bigfunc2.c<br>
bigfunc2.c:17:1: error: unknown type name '__global__'<br>
__global__ void foo22(int *a, int *b, int *c) {<br>
^<br>
bigfunc2.c:17:12: error: expected identifier or '('<br>
__global__ void foo22(int *a, int *b, int *c) {<br>
^<br>
#include <cuda.h><br>
<br>
#define N_WAVE 1024<br>
#define LOG2_N_WAVE 10<br></blockquote><div><br></div><div>These are usually defined as preprocessor macros in the CUDA headers, something like:</div><div><br></div><div>#define __device__ __attribute__((device))<br>
</div><div><br></div><div>You can take a peek at the public CUDA headers for more information. </div><div><br></div><div>Eli</div><div><br></div><div><br></div><div> </div></div></div></div>