clang-tutor icon indicating copy to clipboard operation
clang-tutor copied to clipboard

Example for instrumenting source code

Open ArchanaaSK opened this issue 4 years ago • 1 comments

Thank you! This is very helpful. Do you have any example plugins for adding functions to source code? I would like an example for adding a new function, with simple and complex variables(like structures ), which also uses inputs form the original source code. For example, an example plugin to ASTMatcher and Rewriter/Refactoring/Replacement tools in a plugin.

ArchanaaSK avatar Jul 31 '20 14:07 ArchanaaSK

Hi @ArchanaaSK,

Thank you for visiting and for your question!

Do you have any example plugins for adding functions to source code?

No, I've not tried implementing anything like that for Clang. Do you have a motivating example? This could be an interesting thing to try! Although, to be perfectly honest, I'm not sure where such function should be defined.

I did implement something similar for LLVM IR. See here and here.

banach-space avatar Aug 03 '20 13:08 banach-space