[all-commits] [llvm/llvm-project] a807e8: [analyzer] Prettify checker registration and unitt...

Donát Nagy via All-commits all-commits at lists.llvm.org
Tue Jul 22 04:37:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a807e8ea9f6ecf151e2ccc84af05431e54be8dda
      https://github.com/llvm/llvm-project/commit/a807e8ea9f6ecf151e2ccc84af05431e54be8dda
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-07-22 (Tue, 22 Jul 2025)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
    M clang/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp
    M clang/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp
    M clang/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp
    M clang/unittests/StaticAnalyzer/BlockEntranceCallbackTest.cpp
    M clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp
    M clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
    M clang/unittests/StaticAnalyzer/CallEventTest.cpp
    M clang/unittests/StaticAnalyzer/ConflictingEvalCallsTest.cpp
    M clang/unittests/StaticAnalyzer/ExprEngineVisitTest.cpp
    M clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
    M clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp
    M clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp
    M clang/unittests/StaticAnalyzer/ObjcBug-124477.cpp
    M clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
    M clang/unittests/StaticAnalyzer/SValSimplifyerTest.cpp
    M clang/unittests/StaticAnalyzer/SValTest.cpp
    M clang/unittests/StaticAnalyzer/TestReturnValueUnderConstruction.cpp

  Log Message:
  -----------
  [analyzer] Prettify checker registration and unittest code (#147797)

This commit tweaks the interface of `CheckerRegistry::addChecker` to
make it more practical for plugins and tests:
- The parameter `IsHidden` now defaults to `false` even in the
  non-templated overload (because setting it to true is unusual,
  especially in plugins).
- The parameter `DocsUri` defaults to the dummy placeholder string
  `"NoDocsUri"` because (as of now) nothing queries its value from the
  checker registry (it's only used by the logic that generates the
  clang-tidy documentation, but that loads it directly from `Checkers.td`
  without involving the `CheckerRegistry`), so there is no reason to
  demand specifying this value.

In addition to propagating these changes, this commit clarifies,
corrects and extends lots of comments and performs various minor code
quality improvements in the code of unit tests and example plugins.

I originally wrote the bulk of this commit when I was planning to add an
extra parameter to `addChecker` in order to implement some technical
details of the CheckerFamily framework. At the end I decided against
adding that extra parameter, so this cleanup was left out of the PR
https://github.com/llvm/llvm-project/pull/139256 and I'm merging it now
as a separate commit (after minor tweaks).

This commit is mostly NFC: the only functional change is that the
analyzer will be compatible with plugins that rely on the default
argument values and don't specify `IsHidden` or `DocsUri`. (But existing
plugin code will remain valid as well.)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list