36 #include "llvm/ADT/StringExtras.h"
37 #include "llvm/Support/Path.h"
39 using namespace clang;
66 std::min(static_cast<char>(Lhs), static_cast<char>(Rhs)));
69 const char *getNullabilityString(
Nullability Nullab) {
71 case Nullability::Contradicted:
72 return "contradicted";
77 case Nullability::Nonnull:
80 llvm_unreachable(
"Unexpected enumeration.");
89 NullableAssignedToNonnull,
90 NullableReturnedToNonnull,
92 NullablePassedToNonnull
95 class NullabilityChecker
96 :
public Checker<check::Bind, check::PreCall, check::PreStmt<ReturnStmt>,
97 check::PostCall, check::PostStmt<ExplicitCastExpr>,
98 check::PostObjCMessage, check::DeadSymbols,
99 check::Event<ImplicitNullDerefEvent>> {
100 mutable std::unique_ptr<BugType> BT;
121 const char *Sep)
const override;
123 struct NullabilityChecksFilter {
131 CheckName CheckNameNullReturnedFromNonnull;
133 CheckName CheckNameNullablePassedToNonnull;
134 CheckName CheckNameNullableReturnedFromNonnull;
137 NullabilityChecksFilter Filter;
145 class NullabilityBugVisitor
148 NullabilityBugVisitor(
const MemRegion *M) : Region(M) {}
150 void Profile(llvm::FoldingSetNodeID &
ID)
const override {
153 ID.AddPointer(Region);
171 void reportBugIfInvariantHolds(StringRef Msg,
ErrorKind Error,
174 const Stmt *ValueExpr =
nullptr,
175 bool SuppressPath =
false)
const;
179 const Stmt *ValueExpr =
nullptr)
const {
181 BT.reset(
new BugType(
this,
"Nullability",
"Memory error"));
183 auto R = llvm::make_unique<BugReport>(*BT, Msg, N);
185 R->markInteresting(Region);
186 R->addVisitor(llvm::make_unique<NullabilityBugVisitor>(Region));
189 R->addRange(ValueExpr->getSourceRange());
190 if (Error == ErrorKind::NilAssignedToNonnull ||
191 Error == ErrorKind::NilPassedToNonnull ||
192 Error == ErrorKind::NilReturnedToNonnull)
201 bool CheckSuperRegion =
false)
const;
205 bool isDiagnosableCall(
const CallEvent &Call)
const {
213 class NullabilityState {
216 : Nullab(Nullab), Source(Source) {}
218 const Stmt *getNullabilitySource()
const {
return Source; }
222 void Profile(llvm::FoldingSetNodeID &ID)
const {
223 ID.AddInteger(static_cast<char>(Nullab));
224 ID.AddPointer(Source);
227 void print(raw_ostream &Out)
const {
228 Out << getNullabilityString(Nullab) <<
"\n";
240 bool operator==(NullabilityState Lhs, NullabilityState Rhs) {
241 return Lhs.getValue() == Rhs.getValue() &&
242 Lhs.getNullabilitySource() == Rhs.getNullabilitySource();
276 enum class NullConstraint { IsNull, IsNotNull, Unknown };
282 return NullConstraint::IsNotNull;
284 return NullConstraint::IsNull;
289 NullabilityChecker::getTrackRegion(
SVal Val,
bool CheckSuperRegion)
const {
297 const MemRegion *Region = RegionSVal->getRegion();
299 if (CheckSuperRegion) {
303 return dyn_cast<SymbolicRegion>(ElementReg->getSuperRegion());
315 const NullabilityState *TrackedNullab = State->get<NullabilityMap>(Region);
316 const NullabilityState *TrackedNullabPrev =
317 StatePrev->get<NullabilityMap>(Region);
321 if (TrackedNullabPrev &&
322 TrackedNullabPrev->getValue() == TrackedNullab->getValue())
326 const Stmt *
S = TrackedNullab->getNullabilitySource();
337 std::string InfoText =
338 (llvm::Twine(
"Nullability '") +
339 getNullabilityString(TrackedNullab->getValue()) +
"' is infered")
355 return Nullability::Nonnull;
371 State->getSVal(RegionVal->getRegion()).getAs<DefinedOrUnknownSVal>();
385 for (
const auto *ParamDecl : Params) {
386 if (ParamDecl->isParameterPack())
389 SVal LV = State->getLValue(ParamDecl, LocCtxt);
391 ParamDecl->getType())) {
402 if (!MD || !MD->isInstanceMethod())
409 SVal SelfVal = State->getSVal(State->getRegion(SelfDecl, LocCtxt));
420 for (
const auto *IvarDecl : ID->
ivars()) {
421 SVal LV = State->getLValue(IvarDecl, SelfVal);
431 if (State->get<InvariantViolated>())
440 if (
const auto *BD = dyn_cast<BlockDecl>(D))
441 Params = BD->parameters();
442 else if (
const auto *FD = dyn_cast<FunctionDecl>(D))
443 Params = FD->parameters();
444 else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
445 Params = MD->parameters();
458 void NullabilityChecker::reportBugIfInvariantHolds(StringRef Msg,
466 OriginalState = OriginalState->set<InvariantViolated>(
true);
474 void NullabilityChecker::checkDeadSymbols(
SymbolReaper &SR,
480 NullabilityMapTy Nullabilities = State->get<NullabilityMap>();
482 E = Nullabilities.end();
485 assert(Region &&
"Non-symbolic region is tracked.");
486 if (SR.
isDead(Region->getSymbol())) {
487 State = State->remove<NullabilityMap>(
I->first);
507 getTrackRegion(Event.
Location,
true);
512 const NullabilityState *TrackedNullability =
513 State->get<NullabilityMap>(Region);
515 if (!TrackedNullability)
518 if (Filter.CheckNullableDereferenced &&
524 reportBug(
"Nullable pointer is dereferenced",
525 ErrorKind::NullableDereferenced, Event.
SinkNode, Region, BR);
527 reportBug(
"Nullable pointer is passed to a callee that requires a "
528 "non-null", ErrorKind::NullablePassedToNonnull,
541 while (
auto *ICE = dyn_cast<ImplicitCastExpr>(E)) {
542 E = ICE->getSubExpr();
550 void NullabilityChecker::checkPreStmt(
const ReturnStmt *S,
556 if (!RetExpr->getType()->isAnyPointerType())
560 if (State->get<InvariantViolated>())
568 bool InSuppressedMethodFamily =
false;
574 if (
auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
581 InSuppressedMethodFamily =
true;
583 RequiredRetType = MD->getReturnType();
584 }
else if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
585 RequiredRetType = FD->getReturnType();
602 bool NullReturnedFromNonNull = (RequiredNullability == Nullability::Nonnull &&
603 Nullness == NullConstraint::IsNull);
604 if (Filter.CheckNullReturnedFromNonnull &&
605 NullReturnedFromNonNull &&
606 RetExprTypeLevelNullability != Nullability::Nonnull &&
607 !InSuppressedMethodFamily &&
615 llvm::raw_svector_ostream OS(SBuf);
617 " that is expected to return a non-null value";
619 reportBugIfInvariantHolds(OS.str(),
620 ErrorKind::NilReturnedToNonnull, N,
nullptr, C,
627 if (NullReturnedFromNonNull) {
628 State = State->set<InvariantViolated>(
true);
633 const MemRegion *Region = getTrackRegion(*RetSVal);
637 const NullabilityState *TrackedNullability =
638 State->get<NullabilityMap>(Region);
639 if (TrackedNullability) {
640 Nullability TrackedNullabValue = TrackedNullability->getValue();
641 if (Filter.CheckNullableReturnedFromNonnull &&
642 Nullness != NullConstraint::IsNotNull &&
644 RequiredNullability == Nullability::Nonnull) {
649 llvm::raw_svector_ostream OS(SBuf);
651 " that is expected to return a non-null value";
653 reportBugIfInvariantHolds(OS.str(),
654 ErrorKind::NullableReturnedToNonnull, N,
660 State = State->set<NullabilityMap>(Region,
661 NullabilityState(RequiredNullability,
669 void NullabilityChecker::checkPreCall(
const CallEvent &Call,
675 if (State->get<InvariantViolated>())
682 if (Param->isParameterPack())
685 const Expr *ArgExpr =
nullptr;
692 if (!Param->getType()->isAnyPointerType() &&
693 !Param->getType()->isReferenceType())
703 unsigned ParamIdx = Param->getFunctionScopeIndex() + 1;
705 if (Filter.CheckNullPassedToNonnull && Nullness == NullConstraint::IsNull &&
706 ArgExprTypeLevelNullability != Nullability::Nonnull &&
707 RequiredNullability == Nullability::Nonnull &&
708 isDiagnosableCall(Call)) {
713 llvm::raw_svector_ostream OS(SBuf);
714 OS <<
"Null passed to a callee that requires a non-null " << ParamIdx
715 << llvm::getOrdinalSuffix(ParamIdx) <<
" parameter";
716 reportBugIfInvariantHolds(OS.str(), ErrorKind::NilPassedToNonnull, N,
722 const MemRegion *Region = getTrackRegion(*ArgSVal);
726 const NullabilityState *TrackedNullability =
727 State->get<NullabilityMap>(Region);
729 if (TrackedNullability) {
730 if (Nullness == NullConstraint::IsNotNull ||
734 if (Filter.CheckNullablePassedToNonnull &&
735 RequiredNullability == Nullability::Nonnull &&
736 isDiagnosableCall(Call)) {
739 llvm::raw_svector_ostream OS(SBuf);
740 OS <<
"Nullable pointer is passed to a callee that requires a non-null "
741 << ParamIdx << llvm::getOrdinalSuffix(ParamIdx) <<
" parameter";
742 reportBugIfInvariantHolds(OS.str(),
743 ErrorKind::NullablePassedToNonnull, N,
744 Region, C, ArgExpr,
true);
747 if (Filter.CheckNullableDereferenced &&
748 Param->getType()->isReferenceType()) {
750 reportBugIfInvariantHolds(
"Nullable pointer is dereferenced",
751 ErrorKind::NullableDereferenced, N, Region,
760 State = State->set<NullabilityMap>(
761 Region, NullabilityState(ArgExprTypeLevelNullability, ArgExpr));
763 if (State != OrigState)
768 void NullabilityChecker::checkPostCall(
const CallEvent &Call,
783 if (State->get<InvariantViolated>())
794 if (llvm::sys::path::filename(FilePath).startswith(
"CG")) {
795 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
800 const NullabilityState *TrackedNullability =
801 State->get<NullabilityMap>(Region);
803 if (!TrackedNullability &&
815 return Nullability::Nonnull;
823 if (Nullness == NullConstraint::IsNotNull)
824 return Nullability::Nonnull;
827 if (ValueRegionSVal) {
828 const MemRegion *SelfRegion = ValueRegionSVal->getRegion();
831 const NullabilityState *TrackedSelfNullability =
832 State->get<NullabilityMap>(SelfRegion);
833 if (TrackedSelfNullability)
834 return TrackedSelfNullability->getValue();
842 void NullabilityChecker::checkPostObjCMessage(
const ObjCMethodCall &M,
852 if (State->get<InvariantViolated>())
855 const MemRegion *ReturnRegion = getTrackRegion(M.getReturnValue());
859 auto Interface =
Decl->getClassInterface();
864 if (
Name.startswith(
"NS")) {
875 State->set<NullabilityMap>(ReturnRegion, Nullability::Contradicted);
881 if (
Name.find(
"Array") != StringRef::npos &&
882 (FirstSelectorSlot ==
"firstObject" ||
883 FirstSelectorSlot ==
"lastObject")) {
885 State->set<NullabilityMap>(ReturnRegion, Nullability::Contradicted);
894 if (
Name.find(
"String") != StringRef::npos) {
896 if (Param->getName() ==
"encoding") {
897 State = State->set<NullabilityMap>(ReturnRegion,
898 Nullability::Contradicted);
909 const NullabilityState *NullabilityOfReturn =
910 State->get<NullabilityMap>(ReturnRegion);
912 if (NullabilityOfReturn) {
916 Nullability RetValTracked = NullabilityOfReturn->getValue();
918 getMostNullable(RetValTracked, SelfNullability);
919 if (ComputedNullab != RetValTracked &&
921 const Stmt *NullabilitySource =
922 ComputedNullab == RetValTracked
923 ? NullabilityOfReturn->getNullabilitySource()
925 State = State->set<NullabilityMap>(
926 ReturnRegion, NullabilityState(ComputedNullab, NullabilitySource));
940 RetNullability = Nullability::Nonnull;
942 Nullability ComputedNullab = getMostNullable(RetNullability, SelfNullability);
944 const Stmt *NullabilitySource = ComputedNullab == RetNullability
947 State = State->set<NullabilityMap>(
948 ReturnRegion, NullabilityState(ComputedNullab, NullabilitySource));
967 if (State->get<InvariantViolated>())
979 const MemRegion *Region = getTrackRegion(*RegionSVal);
984 if (DestNullability == Nullability::Nonnull) {
986 if (Nullness == NullConstraint::IsNull) {
987 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
993 const NullabilityState *TrackedNullability =
994 State->get<NullabilityMap>(Region);
996 if (!TrackedNullability) {
999 State = State->set<NullabilityMap>(Region,
1000 NullabilityState(DestNullability, CE));
1005 if (TrackedNullability->getValue() != DestNullability &&
1006 TrackedNullability->getValue() != Nullability::Contradicted) {
1007 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
1016 if (
auto *BinOp = dyn_cast<BinaryOperator>(S)) {
1017 if (BinOp->getOpcode() == BO_Assign)
1018 return BinOp->getRHS();
1022 if (
auto *DS = dyn_cast<DeclStmt>(S)) {
1023 if (DS->isSingleDecl()) {
1024 auto *VD = dyn_cast<
VarDecl>(DS->getSingleDecl());
1028 if (
const Expr *Init = VD->getInit())
1057 if (!DS || !DS->isSingleDecl())
1060 auto *VD = dyn_cast<
VarDecl>(DS->getSingleDecl());
1065 if(!VD->getType().getQualifiers().hasObjCLifetime())
1068 const Expr *Init = VD->getInit();
1069 assert(Init &&
"ObjC local under ARC without initializer");
1072 if (!isa<ImplicitValueInitExpr>(Init))
1080 void NullabilityChecker::checkBind(
SVal L,
SVal V,
const Stmt *S,
1083 dyn_cast_or_null<TypedValueRegion>(L.
getAsRegion());
1092 if (State->get<InvariantViolated>())
1096 if (!ValDefOrUnknown)
1102 if (
SymbolRef Sym = ValDefOrUnknown->getAsSymbol())
1112 ValueExprTypeLevelNullability =
1116 bool NullAssignedToNonNull = (LocNullability == Nullability::Nonnull &&
1117 RhsNullness == NullConstraint::IsNull);
1118 if (Filter.CheckNullPassedToNonnull &&
1119 NullAssignedToNonNull &&
1120 ValNullability != Nullability::Nonnull &&
1121 ValueExprTypeLevelNullability != Nullability::Nonnull &&
1129 const Stmt *ValueStmt =
S;
1131 ValueStmt = ValueExpr;
1133 reportBugIfInvariantHolds(
"Null is assigned to a pointer which is "
1134 "expected to have non-null value",
1135 ErrorKind::NilAssignedToNonnull, N,
nullptr, C,
1142 if (NullAssignedToNonNull) {
1143 State = State->set<InvariantViolated>(
true);
1151 const MemRegion *ValueRegion = getTrackRegion(*ValDefOrUnknown);
1155 const NullabilityState *TrackedNullability =
1156 State->get<NullabilityMap>(ValueRegion);
1158 if (TrackedNullability) {
1159 if (RhsNullness == NullConstraint::IsNotNull ||
1162 if (Filter.CheckNullablePassedToNonnull &&
1163 LocNullability == Nullability::Nonnull) {
1166 reportBugIfInvariantHolds(
"Nullable pointer is assigned to a pointer "
1167 "which is expected to have non-null value",
1168 ErrorKind::NullableAssignedToNonnull, N,
1179 const Stmt *NullabilitySource = BinOp ? BinOp->getRHS() :
S;
1180 State = State->set<NullabilityMap>(
1181 ValueRegion, NullabilityState(ValNullability, NullabilitySource));
1187 const Stmt *NullabilitySource = BinOp ? BinOp->getLHS() :
S;
1188 State = State->set<NullabilityMap>(
1189 ValueRegion, NullabilityState(LocNullability, NullabilitySource));
1194 void NullabilityChecker::printState(raw_ostream &Out,
ProgramStateRef State,
1195 const char *NL,
const char *Sep)
const {
1197 NullabilityMapTy B = State->get<NullabilityMap>();
1205 Out <<
I->first <<
" : ";
1206 I->second.print(Out);
1211 #define REGISTER_CHECKER(name, trackingRequired) \
1212 void ento::register##name##Checker(CheckerManager &mgr) { \
1213 NullabilityChecker *checker = mgr.registerChecker<NullabilityChecker>(); \
1214 checker->Filter.Check##name = true; \
1215 checker->Filter.CheckName##name = mgr.getCurrentCheckName(); \
1216 checker->NeedTracking = checker->NeedTracking || trackingRequired; \
1217 checker->NoDiagnoseCallsToSystemHeaders = \
1218 checker->NoDiagnoseCallsToSystemHeaders || \
1219 mgr.getAnalyzerOptions().getBooleanOption( \
1220 "NoDiagnoseCallsToSystemHeaders", false, checker, true); \
static bool checkParamsForPreconditionViolation(ArrayRef< ParmVarDecl * > Params, ProgramStateRef State, const LocationContext *LocCtxt)
virtual SVal getArgSVal(unsigned Index) const
Returns the value of a given argument at the time of the call.
TypedValueRegion - An abstract class representing regions having a typed value.
bool isConstrainedFalse() const
Return true if the constraint is perfectly constrained to 'false'.
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
ExplodedNode * generateErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
bool isInSystemHeader() const
Returns true if the callee is known to be from a system header.
bool hasDeadSymbols() const
bool isInstanceMessage() const
bool operator==(CanQual< T > x, CanQual< U > y)
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
FunctionType - C99 6.7.5.3 - Function Declarators.
A helper class which wraps a boolean value set to false by default.
virtual bool inTopFrame() const
Return true if the current LocationContext has no caller context.
static bool checkValueAtLValForInvariantViolation(ProgramStateRef State, SVal LV, QualType T)
Returns true when the value stored at the given location is null and the passed in type is nonnnull...
ProgramPoint getLocation() const
getLocation - Returns the edge associated with the given node.
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph).
virtual QualType getValueType() const =0
const RegionTy * getAs() const
The base class of the type hierarchy.
StringRef getDeclDescription(const Decl *D)
Returns the word that should be used to refer to the declaration in the report.
static Nullability getReceiverNullability(const ObjCMethodCall &M, ProgramStateRef State)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isReceiverSelfOrSuper() const
Checks if the receiver refers to 'self' or 'super'.
ObjCMethodDecl - Represents an instance or class method declaration.
ExplodedNode * getPredecessor()
Returns the previous node in the exploded graph, which includes the state of the program before the c...
ParmVarDecl - Represents a parameter to a function.
const bool wasInlined
If we are post visiting a call, this flag will be set if the call was inlined.
static NullConstraint getNullConstraint(DefinedOrUnknownSVal Val, ProgramStateRef State)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
ObjCMethodFamily
A family of Objective-C methods.
AnalysisDeclContext contains the context data for the function or method under analysis.
bool isAnyPointerType() const
This class provides a convenience implementation for clone() using the Curiously-Recurring Template P...
AnalysisDeclContext * getAnalysisDeclContext() const
BugReporter & getBugReporter()
Values of this type can be null.
Represents any expression that calls an Objective-C method.
virtual Kind getKind() const =0
Returns the kind of call this is.
SVal getReceiverSVal() const
Returns the value of the receiver at the time of this call.
const LangOptions & getLangOpts() const
QualType getReturnType() const
Whether values of this type can be null is (explicitly) unspecified.
A builtin binary operation expression such as "x + y" or "x <= y".
const Decl * getDecl() const
Represents an ObjC class declaration.
detail::InMemoryDirectory::const_iterator I
We dereferenced a location that may be null.
const LocationContext * getLocationContext() const
ArrayRef< ParmVarDecl * > parameters() const override
StringRef getFilename(SourceLocation SpellingLoc) const
Return the filename of the file containing a SourceLocation.
SymbolicRegion - A special, "non-concrete" region.
bool isDead(SymbolRef sym) const
Returns whether or not a symbol has been confirmed dead.
virtual const Expr * getArgExpr(unsigned Index) const
Returns the expression associated with a given argument.
Expr - This represents one expression.
const ProgramStateRef & getState() const
StringRef getName() const
Return the actual identifier string.
virtual ArrayRef< ParmVarDecl * > parameters() const =0
Return call's formal parameters.
const ProgramStateRef & getState() const
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
An expression that sends a message to the given Objective-C object or class.
#define REGISTER_CHECKER(name, trackingRequired)
REGISTER_MAP_WITH_PROGRAMSTATE(NullabilityMap, const MemRegion *, NullabilityState) enum class NullConstraint
BugReporter is a utility class for generating PathDiagnostics for analysis.
#define REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, Type)
Declares a program state trait for type Type called Name, and introduce a typedef named NameTy...
const TemplateArgument * iterator
static bool isARCNilInitializedLocal(CheckerContext &C, const Stmt *S)
Returns true if.
void emitReport(std::unique_ptr< BugReport > R)
Add the given report to the set of reports tracked by BugReporter.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
static const Expr * lookThroughImplicitCasts(const Expr *E)
Find the outermost subexpression of E that is not an implicit cast.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
Selector getSelector() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
static bool checkInvariantViolation(ProgramStateRef State, ExplodedNode *N, CheckerContext &C)
const Decl * getDecl() const
A class responsible for cleaning up unused symbols.
static const Expr * matchValueExprForBind(const Stmt *S)
For a given statement performing a bind, attempt to syntactically match the expression resulting in t...
const ObjCMethodDecl * getDecl() const override
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
ASTContext & getASTContext()
detail::InMemoryDirectory::const_iterator E
const MemRegion * getAsRegion() const
const Expr * getRetValue() const
bool isConstrainedTrue() const
Return true if the constraint is perfectly constrained to 'true'.
Represents an abstract call to a function or method along a particular path.
ExplicitCastExpr - An explicit cast written in the source code.
Optional< T > getAs() const
Convert to the specified ProgramPoint type, returning None if this ProgramPoint is not of the desired...
ObjCMessageKind getMessageKind() const
Returns how the message was written in the source (property access, subscript, or explicit message se...
Represents a pointer to an Objective C object.
const T * getAs() const
Member-template getAs<specific type>'.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
const ImplicitParamDecl * getSelfDecl() const
static Nullability getNullabilityAnnotation(QualType Type)
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
An attributed type is a type to which a type attribute has been applied.
bool trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S, BugReport &R, bool IsArg=false, bool EnableNullFPSuppression=true)
Attempts to add visitors to trace a null or undefined value back to its point of origin, whether it is a symbol constrained to null or an explicit assignment.
SourceManager & getSourceManager()
virtual unsigned getNumArgs() const =0
Returns the number of arguments (explicit and implicit).
static bool checkSelfIvarsForInvariantViolation(ProgramStateRef State, const LocationContext *LocCtxt)
ElementRegin is used to represent both array elements and casts.
Tag that can use a checker name as a message provider (see SimpleProgramPointTag).
This class provides an interface through which checkers can create individual bug reports...
virtual const ObjCMessageExpr * getOriginExpr() const
SVal getReturnValue() const
Returns the return value of the call.
This class handles loading and caching of source files into memory.
SourceManager & getSourceManager()
const LocationContext * getLocationContext() const