[clang-tidy] calling Sema from tidy + miscellaneous questions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[clang-tidy] calling Sema from tidy + miscellaneous questions

Deep Majumder via cfe-dev
Hi I am working on a clang-tidy check to add constexpr to functions and I have a couple of questions:

1 - The checker I am working on calls Sema::CheckConstexprFunctionDefinition as well as other functions that require a Sema reference. I currently don't see a way to call Sema from a clang-tidy check. I am wondering what would be the best way to accomplish that. Would saving a pointer to CompilerInstance in the SourceManager would be a good solution?

2 - In the checker I sometimes need to suppress diagnostics and then re-enable them. Does llvm have a "run at end of scope class" (similar to gsl::finally  https://github.com/microsoft/GSL/blob/master/include/gsl/util#L50-L80)?

3 - Somewhat unrelated to this checker specifically. We use code similar to clang::arcmt::trans::findSemiAfterLocation in a fair bit of our checkers. I see that we already had discussions about moving this to a better/more discoverable location:
I am willing to do the work, just a bit unsure of where it should be moved so that both arcmigrate and clang-tidy can access it.


cfe-dev mailing list
[hidden email]