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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 14:42:56 PST 2018


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

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.



================
Comment at: test/Analysis/free.c:1
-// RUN: %clang_analyze_cc1 -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify %s
-// RUN: %clang_analyze_cc1 -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config unix.Malloc:Optimistic=true %s
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -analyzer-store=region \
+// RUN:   -analyzer-checker=core \
----------------
When cleaning this stuff up, please feel free to drop `-analyzer-store=region` entirely (same for other options that allow only one value).


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

https://reviews.llvm.org/D55429





More information about the cfe-commits mailing list