[PATCH] D57855: [analyzer] Reimplement checker options

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 6 15:22:38 PST 2019

Szelethus created this revision.
Szelethus added reviewers: NoQ, george.karpenkov, xazax.hun, rnkovacs, baloghadamsoftware.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, mgrang, szepet, whisperity.
Herald added a project: clang.

Here we go guys! This patch is I believe the most important since I started working on this `AnalyzerOptions` refactoring effort.

It's been a long standing issue that checker options were deep hidden within the implementation, not even necessarily on the bottom of the checker files, in some cases they were totally undocumented, and the possibility of user error due to them being so long was enormous, while at the same time giving no warnings or errors at all.

This patch, similarly to how dependencies were reimplemented, uses TableGen to register checker options, add them to both `CheckerRegistry` and `AnalyzerOptions` while at the same time exposing the same functionality to non-generated statically linked and plugin checkers.

In detail:

- Add checker and package options to the TableGen files
  - Added a new class called `CmdLineOption`, and both `Package` and `Checker` recieved a `list<CmdLineOption>` field.
  - Added every existing checker option to `Checkers.td`. I'm a little unsure about some, so take a look I guess!
- `AnalyzerOptions` now inserts every checker option with their default value to it's `ConfigTable` (insertion fails if the user specified that option already)
- The `CheckerRegistry` class
  - Received some comments to most of it's inline classes
  - Received the `CmdLineOption` and `PackageInfo` inline classes, a list of `CmdLineOption` was added to `CheckerInfo` and `PackageInfo`
  - Moved the `addDependency` function out-of-line
  - Renamed the cryptic `printHelp` and `printList` functions
  - Added `addCheckerOption` and `addPackageOption`
  - Added a new field called `Packages`, used in `addPackageOptions`, filled up in `addPackage`
  - `validateCheckerOptions` was refactored, but actual checker option validation will come in a later patch

I know this patch is huge, and if it's a big burden, I'll look for ways to cut some pieces out, but I definitely didn't want to delay showing the overall direction any longer.

  rC Clang



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57855.185648.patch
Type: text/x-patch
Size: 43908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190206/545cbf0b/attachment-0001.bin>

More information about the cfe-commits mailing list