Source to source translation using Clang


I am currently working on source to source transformation of OpenCL kernel to a highly parallel DSP language called C^n.

Now, I have learnt and understood the ast generation and basic rewrite functionalities to manipulate ast. But I’ve been facing tons of errors.

All I want is a complete guide on how to install clang on Ubuntu(I’ve done it according to steps given on llvm website) and any trivial code on source to source transformation and how to run that code and get the output.

I have tried running different examples found on Internet but I am not able to run the code in any of them. I have spent hours on trying to solve the errors but cannot get rid of some errors and I am stuck at a point where I am not able to find any information to rectify the problem. I need to get ANY source to source translation code running.
Any code with information on how to get it running will do.
Please help me out with it.


Vibhav Kundalia


It would be good if you mention step by step what exactly you tried and what error you are getting.
Your query seems too generic and it would be good if you point out the specifics.

Also, please follow to build LLVM/Clang on your system.

Suyog Sarda