A source to source transformation tool for C using clang LibTooling, which creates a new c source file which emulates call-by-name calling convension.
- Clone the llvm repository using 'git clone https://github.com/llvm/llvm-project.git'
- Extract the zip file to llvm/clang/tools/clang-cbn. (The files including ClangCBN.cpp should be inside llvm/clang/tools/clang-cbn)
- Add the line 'add_subdirectory(clang-cbn)' to llvm/clang/tools/CMakeLists.txt
- Compile the clang source tree using cmake.
- A new executable named clang-cbn will be created in the bin directory under the build directory.
- Invoke the tool using bin/clang-cbn inputfile_path -- (Don't forget the -- in the end)
- The tool will print the rewtitten code to stdout. Redirect it to a file and pass it to the c compiler.
- ClangCBN.cpp: This file contains the code for source to source transformation of a c program to emulates call-by-name calling convension.
- CMakeLists.txt CMake file to build ClangCBN.cpp