[all-commits] [llvm/llvm-project] 72ee9b: [NFC][analyzer] Rename `CheckerBase::getCheckerNam...

Donát Nagy via All-commits all-commits at lists.llvm.org
Wed Mar 12 06:49:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72ee9b82151f17d6bd37abc501124d46c1cb63c3
      https://github.com/llvm/llvm-project/commit/72ee9b82151f17d6bd37abc501124d46c1cb63c3
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-03-12 (Wed, 12 Mar 2025)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
    M clang/include/clang/StaticAnalyzer/Core/Checker.h
    M clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ReturnValueChecker.cpp
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    M clang/lib/StaticAnalyzer/Core/Checker.cpp
    M clang/lib/StaticAnalyzer/Core/CheckerManager.cpp

  Log Message:
  -----------
  [NFC][analyzer] Rename `CheckerBase::getCheckerName` to `getName` (#130953)

The method name `getCheckerName` would imply "get the name of the
checker associated with `this`", so it's suitable for e.g.
`BugType::getCheckerName` -- but a method that just "gets the name of
`this`" should be simply called `getName`.

This change eliminates the redundant and ugly pattern
`Checker->getCheckerName()` and helps to visually distinguish this
method from `BugType::getCheckerName`.

In the constructor of `BugType` the call of this method was completely
removed (instead of just changing the name) because that call was dead
code (when the data member `Checker` is non-null, the string stored in
`CheckerName` is irrelevant) and was often querying the name of the
checker before it was properly initialized.

Moreover, in `ReturnValueChecker.cpp` the static helper function
`getName` (which gets a function name from a `CallEvent`) was renamed to
the more specific `getFunctionName` to avoid the name collision.

This change is yet another cleanup commit before my planned changes that
would add support for multi-part checkers to this method.



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