[PATCH] D55429: [analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 15:14:52 PST 2018


Szelethus added a comment.

In D55429#1324035 <https://reviews.llvm.org/D55429#1324035>, @NoQ wrote:

> Aha, ok, so what's the final procedure




In D55429#1324035 <https://reviews.llvm.org/D55429#1324035>, @NoQ wrote:

> Aha, ok, so what's the final procedure now to register a checker that's artificially split in two? Something like this, right?
>
>   def CommonModel : Checker<"Common">,
>     HelpText<"Doesn't emit warnings but models common stuff.">;
>  
>   def SubChecker : Checker<"Sub">,
>     HelpText<"Emits common warnings for the sub-stuff.">,
>     Dependencies<[CommonModel]>;
>
>
>
>
>   void registerCommonModel(CheckerManager &Mgr) {
>     Mgr.registerChecker<CommonModel>();
>   }
>  
>   void registerSubChecker(CheckerManager &Mgr) {
>     CommonModel *Model = Mgr.getChecker<CommonModel>();
>     Model->EnableSubChecker = true;
>   }
>
>
> This looks quite usable to me.


Correct! But since I spent so much time with these files, and I don't expect maaajor changes to them in the foreseeable future, I'll take the time to properly document how the frontend of the analyzer (especially how checker registration) works. Maybe with the new sphinx format if it goes through by then, but any format is better than none.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55429/new/

https://reviews.llvm.org/D55429





More information about the cfe-commits mailing list