[cfe-dev] Odd behaviour with '-save-temps' and OpenCL files

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 7 04:56:47 PST 2016


On Mon, Nov 07, 2016 at 10:55:32AM +0000, mats petersson wrote:
> And how does the parser know from the preprocessed output that it is CL
> rather than C that it's parsing? I suspect it's the ".cl" part of the name
> of "filename.cl" that determines that it's CL code in the first place, if
> that gets replaced with "filename.i", the parser will just say "Ah, it's
> C-code and has already been preprocessed".

Likely.

> Maybe the parser needs a `-x cl` or similar to ensure that the parser knows
> it's CL-code?

A better idea might be to emit an appropiate "#pragma clang language
OpenCL" or so at the top of the file.

Joerg



More information about the cfe-dev mailing list