[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 04:15:37 PDT 2025
================
@@ -31,34 +31,38 @@ namespace {
class CallAndMessageChecker
: public Checker<check::PreObjCMessage, check::ObjCMessageNil,
check::PreCall> {
- mutable std::unique_ptr<BugType> BT_call_null;
- mutable std::unique_ptr<BugType> BT_call_undef;
- mutable std::unique_ptr<BugType> BT_cxx_call_null;
- mutable std::unique_ptr<BugType> BT_cxx_call_undef;
- mutable std::unique_ptr<BugType> BT_call_arg;
- mutable std::unique_ptr<BugType> BT_cxx_delete_undef;
- mutable std::unique_ptr<BugType> BT_msg_undef;
- mutable std::unique_ptr<BugType> BT_objc_prop_undef;
- mutable std::unique_ptr<BugType> BT_objc_subscript_undef;
- mutable std::unique_ptr<BugType> BT_msg_arg;
- mutable std::unique_ptr<BugType> BT_msg_ret;
- mutable std::unique_ptr<BugType> BT_call_few_args;
+ const BugType BT_call_null{
+ this, "Called function pointer is null (null dereference)"};
+ const BugType BT_call_undef{
+ this, "Called function pointer is an uninitialized pointer value"};
+ const BugType BT_cxx_call_null{this, "Called C++ object pointer is null"};
+ const BugType BT_cxx_call_undef{this,
+ "Called C++ object pointer is uninitialized"};
+ const BugType BT_call_arg{this, "Uninitialized argument value"};
+ const BugType BT_cxx_delete_undef{this, "Uninitialized argument value"};
+ const BugType BT_msg_undef{
+ this, "Receiver in message expression is an uninitialized value"};
+ const BugType BT_objc_prop_undef{
+ this, "Property access on an uninitialized object pointer"};
+ const BugType BT_objc_subscript_undef{
+ this, "Subscript access on an uninitialized object pointer"};
+ const BugType BT_msg_arg{this, "Uninitialized argument value"};
+ const BugType BT_msg_ret{this, "Receiver in message expression is 'nil'"};
+ const BugType BT_call_few_args{this, "Function call with too few arguments"};
public:
- // These correspond with the checker options. Looking at other checkers such
- // as MallocChecker and CStringChecker, this is similar as to how they pull
- // off having a modeling class, but emitting diagnostics under a smaller
- // checker's name that can be safely disabled without disturbing the
- // underlaying modeling engine.
- // The reason behind having *checker options* rather then actual *checkers*
- // here is that CallAndMessage is among the oldest checkers out there, and can
+ // Like a checker family, CallAndMessageChecker can produce many kinds of
+ // warnings which can be separately enabled or disabled. However, for
+ // historical reasons these warning kinds are represented by checker options
+ // (and not separate checkcer frontends with their own names) because
----------------
NagyDonat wrote:
Done in https://github.com/llvm/llvm-project/pull/156073/commits/e5e668d6b3488d90fd976d15605fecaa9f691717
https://github.com/llvm/llvm-project/pull/156073
More information about the cfe-commits
mailing list