@@ -31,24 +31,24 @@ namespace {
3131class CallAndMessageChecker
3232 : public Checker<check::PreObjCMessage, check::ObjCMessageNil,
3333 check::PreCall> {
34- const BugType BT_call_null {
34+ const BugType CallNullBug {
3535 this , " Called function pointer is null (null dereference)" };
36- const BugType BT_call_undef {
36+ const BugType CallUndefBug {
3737 this , " Called function pointer is an uninitialized pointer value" };
38- const BugType BT_cxx_call_null {this , " Called C++ object pointer is null" };
39- const BugType BT_cxx_call_undef {this ,
40- " Called C++ object pointer is uninitialized" };
41- const BugType BT_call_arg {this , " Uninitialized argument value" };
42- const BugType BT_cxx_delete_undef {this , " Uninitialized argument value" };
43- const BugType BT_msg_undef {
38+ const BugType CXXCallNullBug {this , " Called C++ object pointer is null" };
39+ const BugType CXXCallUndefBug {this ,
40+ " Called C++ object pointer is uninitialized" };
41+ const BugType CallArgBug {this , " Uninitialized argument value" };
42+ const BugType CXXDeleteUndefBug {this , " Uninitialized argument value" };
43+ const BugType MsgUndefBug {
4444 this , " Receiver in message expression is an uninitialized value" };
45- const BugType BT_objc_prop_undef {
45+ const BugType ObjCPropUndefBug {
4646 this , " Property access on an uninitialized object pointer" };
47- const BugType BT_objc_subscript_undef {
47+ const BugType ObjCSubscriptUndefBug {
4848 this , " Subscript access on an uninitialized object pointer" };
49- const BugType BT_msg_arg {this , " Uninitialized argument value" };
50- const BugType BT_msg_ret {this , " Receiver in message expression is 'nil'" };
51- const BugType BT_call_few_args {this , " Function call with too few arguments" };
49+ const BugType MsgArgBug {this , " Uninitialized argument value" };
50+ const BugType MsgRetBug {this , " Receiver in message expression is 'nil'" };
51+ const BugType CallFewArgsBug {this , " Function call with too few arguments" };
5252
5353public:
5454 // Like a checker family, CallAndMessageChecker can produce many kinds of
@@ -362,7 +362,7 @@ ProgramStateRef CallAndMessageChecker::checkFunctionPointerCall(
362362 C.addSink (State);
363363 return nullptr ;
364364 }
365- emitBadCall (&BT_call_undef , C, Callee);
365+ emitBadCall (&CallUndefBug , C, Callee);
366366 return nullptr ;
367367 }
368368
@@ -374,7 +374,7 @@ ProgramStateRef CallAndMessageChecker::checkFunctionPointerCall(
374374 C.addSink (StNull);
375375 return nullptr ;
376376 }
377- emitBadCall (&BT_call_null , C, Callee);
377+ emitBadCall (&CallNullBug , C, Callee);
378378 return nullptr ;
379379 }
380380
@@ -411,7 +411,7 @@ ProgramStateRef CallAndMessageChecker::checkParameterCount(
411411 << " is called with fewer (" << Call.getNumArgs () << " )" ;
412412
413413 C.emitReport (
414- std::make_unique<PathSensitiveBugReport>(BT_call_few_args , os.str (), N));
414+ std::make_unique<PathSensitiveBugReport>(CallFewArgsBug , os.str (), N));
415415 return nullptr ;
416416}
417417
@@ -424,7 +424,7 @@ ProgramStateRef CallAndMessageChecker::checkCXXMethodCall(
424424 C.addSink (State);
425425 return nullptr ;
426426 }
427- emitBadCall (&BT_cxx_call_undef , C, CC->getCXXThisExpr ());
427+ emitBadCall (&CXXCallUndefBug , C, CC->getCXXThisExpr ());
428428 return nullptr ;
429429 }
430430
@@ -436,7 +436,7 @@ ProgramStateRef CallAndMessageChecker::checkCXXMethodCall(
436436 C.addSink (StNull);
437437 return nullptr ;
438438 }
439- emitBadCall (&BT_cxx_call_null , C, CC->getCXXThisExpr ());
439+ emitBadCall (&CXXCallNullBug , C, CC->getCXXThisExpr ());
440440 return nullptr ;
441441 }
442442
@@ -466,8 +466,7 @@ CallAndMessageChecker::checkCXXDeallocation(const CXXDeallocatorCall *DC,
466466 Desc = " Argument to 'delete[]' is uninitialized" ;
467467 else
468468 Desc = " Argument to 'delete' is uninitialized" ;
469- auto R =
470- std::make_unique<PathSensitiveBugReport>(BT_cxx_delete_undef, Desc, N);
469+ auto R = std::make_unique<PathSensitiveBugReport>(CXXDeleteUndefBug, Desc, N);
471470 bugreporter::trackExpressionValue (N, DE, *R);
472471 C.emitReport (std::move (R));
473472 return nullptr ;
@@ -485,7 +484,7 @@ ProgramStateRef CallAndMessageChecker::checkArgInitializedness(
485484 const bool checkUninitFields =
486485 !(C.getAnalysisManager ().shouldInlineCall () && (D && D->getBody ()));
487486
488- const BugType &BT = isa<ObjCMethodCall>(Call) ? BT_msg_arg : BT_call_arg ;
487+ const BugType &BT = isa<ObjCMethodCall>(Call) ? MsgArgBug : CallArgBug ;
489488
490489 const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
491490 for (unsigned i = 0 , e = Call.getNumArgs (); i != e; ++i) {
@@ -546,13 +545,13 @@ void CallAndMessageChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
546545 const BugType *BT = nullptr ;
547546 switch (msg.getMessageKind ()) {
548547 case OCM_Message:
549- BT = &BT_msg_undef ;
548+ BT = &MsgUndefBug ;
550549 break ;
551550 case OCM_PropertyAccess:
552- BT = &BT_objc_prop_undef ;
551+ BT = &ObjCPropUndefBug ;
553552 break ;
554553 case OCM_Subscript:
555- BT = &BT_objc_subscript_undef ;
554+ BT = &ObjCSubscriptUndefBug ;
556555 break ;
557556 }
558557 assert (BT && " Unknown message kind." );
@@ -601,7 +600,7 @@ void CallAndMessageChecker::emitNilReceiverBug(CheckerContext &C,
601600 }
602601
603602 auto report =
604- std::make_unique<PathSensitiveBugReport>(BT_msg_ret , os.str (), N);
603+ std::make_unique<PathSensitiveBugReport>(MsgRetBug , os.str (), N);
605604 report->addRange (ME->getReceiverRange ());
606605 // FIXME: This won't track "self" in messages to super.
607606 if (const Expr *receiver = ME->getInstanceReceiver ()) {
0 commit comments