Custom Pragmas Clang Tools

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Pragmas Clang Tools

David Zarzycki via cfe-dev
Hello,

I have been reading some articles [1, 2] regarding how to implement handlers for custom pragmas. Nonetheless, in those posts Clang source code has to be modified. I am developing an Clang tool out-of-tree, so I do not want to make a custom version of Clang. I was just wondering if it is possible to build a custom handler for pragmas out-of-tree or if I have to tackle another approach maybe using annotations (?) or any other workaround? Basically I want to use pragmas for indicating loops of interest for the tool in C/C++ code.
Thanks!

Regards,



_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Custom Pragmas Clang Tools

David Zarzycki via cfe-dev
You can create your own executable that creates a CompilerInstance and
adds pragma handles to it.

Example shown here:
https://github.com/Meinersbur/pet/blob/master/pet.cc#L1139

Michael


Am So., 29. Dez. 2019 um 00:32 Uhr schrieb Marcos Horro Varela via
cfe-dev <[hidden email]>:

>
> Hello,
>
> I have been reading some articles [1, 2] regarding how to implement handlers for custom pragmas. Nonetheless, in those posts Clang source code has to be modified. I am developing an Clang tool out-of-tree, so I do not want to make a custom version of Clang. I was just wondering if it is possible to build a custom handler for pragmas out-of-tree or if I have to tackle another approach maybe using annotations (?) or any other workaround? Basically I want to use pragmas for indicating loops of interest for the tool in C/C++ code.
> Thanks!
>
> Regards,
>
> [1] https://blog.quarkslab.com/implementing-a-custom-directive-handler-in-clang.html
> [2] https://git.scc.kit.edu/CES/clang-custom-pragma
>
> H.
> http://gac.udc.es/~horro
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Custom Pragmas Clang Tools

David Zarzycki via cfe-dev
That is exactly what I was looking for.
Thank you so much.

Regards,

On Jan 3 2020, at 8:21 am, Michael Kruse <[hidden email]> wrote:
You can create your own executable that creates a CompilerInstance and
adds pragma handles to it.

Example shown here:
https://github.com/Meinersbur/pet/blob/master/pet.cc#L1139

Michael


Am So., 29. Dez. 2019 um 00:32 Uhr schrieb Marcos Horro Varela via
cfe-dev <[hidden email]>:

Hello,

I have been reading some articles [1, 2] regarding how to implement handlers for custom pragmas. Nonetheless, in those posts Clang source code has to be modified. I am developing an Clang tool out-of-tree, so I do not want to make a custom version of Clang. I was just wondering if it is possible to build a custom handler for pragmas out-of-tree or if I have to tackle another approach maybe using annotations (?) or any other workaround? Basically I want to use pragmas for indicating loops of interest for the tool in C/C++ code.
Thanks!

Regards,

[1] https://blog.quarkslab.com/implementing-a-custom-directive-handler-in-clang.html
[2] https://git.scc.kit.edu/CES/clang-custom-pragma

H.
http://gac.udc.es/~horro
_______________________________________________
cfe-dev mailing list
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Custom Pragmas Clang Tools

David Zarzycki via cfe-dev

FYI: There's also an example plugin that adds a pragma handler:

  https://github.com/llvm/llvm-project/blob/master/clang/examples/AnnotateFunctions/AnnotateFunctions.cpp

 -Hal

On 1/3/20 9:44 AM, Marcos Horro Varela via cfe-dev wrote:
That is exactly what I was looking for.
Thank you so much.

Regards,

On Jan 3 2020, at 8:21 am, Michael Kruse [hidden email] wrote:
You can create your own executable that creates a CompilerInstance and
adds pragma handles to it.

Example shown here:

Michael


Am So., 29. Dez. 2019 um 00:32 Uhr schrieb Marcos Horro Varela via

Hello,

I have been reading some articles [1, 2] regarding how to implement handlers for custom pragmas. Nonetheless, in those posts Clang source code has to be modified. I am developing an Clang tool out-of-tree, so I do not want to make a custom version of Clang. I was just wondering if it is possible to build a custom handler for pragmas out-of-tree or if I have to tackle another approach maybe using annotations (?) or any other workaround? Basically I want to use pragmas for indicating loops of interest for the tool in C/C++ code.
Thanks!

Regards,


H.
_______________________________________________
cfe-dev mailing list

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev