[all-commits] [llvm/llvm-project] 8a5cfd: [analyzer][NFC] Remove useless class BuiltinBug

DonatNagyE via All-commits all-commits at lists.llvm.org
Mon Aug 28 06:26:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a5cfdf7851dcdb4e16c510b133d7d0e79e43fc4
      https://github.com/llvm/llvm-project/commit/8a5cfdf7851dcdb4e16c510b133d7d0e79e43fc4
  Author: DonĂ¡t Nagy <donat.nagy at ericsson.com>
  Date:   2023-08-28 (Mon, 28 Aug 2023)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
    M clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
    M clang/lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
    M clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    M clang/unittests/StaticAnalyzer/CallEventTest.cpp
    M clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
    M clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

  Log Message:
  -----------
  [analyzer][NFC] Remove useless class BuiltinBug

...because it provides no useful functionality compared to its base
class `BugType`.

A long time ago there were substantial differences between `BugType` and
`BuiltinBug`, but they were eliminated by commit 1bd58233 in 2009 (!).
Since then the only functionality provided by `BuiltinBug` was that it
specified `categories::LogicError` as the bug category and it stored an
extra data member `desc`.

This commit sets `categories::LogicError` as the default value of the
third argument (bug category) in the constructors of BugType and
replaces use of the `desc` field with simpler logic.

Note that `BugType` has a data member `Description` and a non-virtual
method `BugType::getDescription()` which queries it; these are distinct
from the member `desc` of `BuiltinBug` and the identically named method
`BuiltinBug::getDescription()` which queries it. This confusing name
collision was a major motivation for the elimination of `BuiltinBug`.

As this commit touches many files, I avoided functional changes and left
behind FIXME notes to mark minor issues that should be fixed later.

Differential Revision: https://reviews.llvm.org/D158855




More information about the All-commits mailing list