Julien Schmitt via llvm-dev
2019-Jun-13 17:12 UTC
[llvm-dev] pragma and function insertion
Dear community, For my project, I defined a #pragma and i would like clang to replace this pragma by a function call. After reading tutorials, I managed to write a plugin which is able to parse and recognize this pragma. Now I have some difficulties to transform this pragma into a function call. My comprehension is that I need first to declare a new annotation token and insert it in the stream. Then I should process this token and call the function I want. Is this approach correct? Can a frontendAction do this job? However, I have the feeling this process should be very common and probably the solution is already written somewhere ... Does anybody have a similar example? Thanks a lot ! -------------------- Julien Schmitt VSORA - immeuble LE PASTEUR 13/15 rue Jeanne Braconnier, 92360 Meudon La ForĂȘt, France Mob : +33 6 66 81 08 76 Email: julien.schmitt at vsora.com Web: www.vsora.com<http://www.vsora.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190613/9d68e49d/attachment.html>
Hi, several OpenMP directives do this, such as #pragma omp flush. It's handling is in StmtOpenMP.cpp (OMPFlushDirective) and CGOpenMPRuntime.cpp (CGOpenMPRuntime::emitFlush) Michael Am Do., 13. Juni 2019 um 12:13 Uhr schrieb Julien Schmitt via llvm-dev <llvm-dev at lists.llvm.org>:> > Dear community, > > For my project, I defined a #pragma and i would like clang to replace this pragma by a function call. > > After reading tutorials, I managed to write a plugin which is able to parse and recognize this pragma. > > Now I have some difficulties to transform this pragma into a function call. > > > My comprehension is that I need first to declare a new annotation token and insert it in the stream. > > Then I should process this token and call the function I want. > Is this approach correct? Can a frontendAction do this job? > > > However, I have the feeling this process should be very common and probably the solution is already written somewhere ... Does anybody have a similar example? > > > Thanks a lot ! > > > > -------------------- > Julien Schmitt > VSORA - immeuble LE PASTEUR > 13/15 rue Jeanne Braconnier, 92360 Meudon La ForĂȘt, France > Mob : +33 6 66 81 08 76 > Email: julien.schmitt at vsora.com > Web: www.vsora.com > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev