NagyDonat wrote: I have yet another implementation idea where: - boilerplate is either minimal or nonexistent; - there is no need to pass an additional string value (the debug name) through the checker registry code; - the debug name is guaranteed to be the same as the class name.
The minimal-boilerplate version looks like ```c++ template <typename T> StringRef getCheckerFamilyName(); #define REGISTER_CHECKER_FAMILY(NAME) template <> StringRef getCheckerFamilyName<NAME>() { return #NAME; } // in the body of CheckerFamily template <typename CHECKER> static void _register(CHECKER *Chk, CheckerManager &Mgr) { Chk->CheckerBackendName = getCheckerFamilyName<CHECKER>(); (CHECKs::_register(Chk, Mgr), ...); } // in each file that implements a checker family REGISTER_CHECKER_FAMILY(MyBeautifulCheckerFamily) ``` If we assume that each checker family class is mentioned in `Checkers.td`, then we can replace `REGISTER_CHECKER_FAMILY` with a header that says ```c++ #define GET_CHECKERS #define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) template <> StringRef getCheckerFamilyName<typename CLASS>() { return #CLASS; } #include "Checkers.inc" #undef CHECKER #undef GET_CHECKERS ``` @steakhal WDYT about this one? https://github.com/llvm/llvm-project/pull/139256 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits