Dear colleagues,<br><br>Consider there is a need to mix sources and headers that are in two different high-level languages. It should be possible, if both languages are lowered down to LLVM IR and merged. But the problem is that clang is unable to generate strict IR code for headers. For example the code<br>
<br>extern __attribute__((device))  int var;<br><br>__attribute__((always_inline)) void kernel()<br>{<br>        var = 2;<br>}<br><br>with<br><br>clang -cc1 <a href="http://test.cu">test.cu</a> -emit-llvm -triple ptx64-unknown-unknown -fcuda-is-device <a href="http://test.cu">test.cu</a> -o -<br>
<br>reasonably produces empty module: the only function is inline and not used.<br><br>So the question: is there an easy way to generate IR with clang strictly for entire header file, with all inlined functions and unused types?<br>
Probably one way would be to write a plugin to add a fictive call of every function and declare fictive variable of every type, but this is stupid. Any better solution?<br><br>Thanks,<br>- Dima.<br><br>