Code reorganization using Clang

I heard of LLVM/Clang several times in the past, and now I want to use it
because it seems just very powerful.
But as it appears a bit hairy for the beginner I am, I'd like to know if I
can achieve what I want before digging in more seriously (note I didn't say
: "how to do it", just "can I do it with Clang")

The goal is to parse OpenCL source code in input, find all global variables
and pack them into a C-struct passed in as argument of all kernels.

for example, an input file would be :

And after custom Clang classes processed the code structure (AST ?), I
obtain the following :

So the question is : does Clang allow to do such processing (adding types
based on existing ones, modifying function signature and function body
contents) ?