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);
156 std::shared_ptr<PathDiagnosticPiece> VisitNode(
const ExplodedNode *N,
171 void reportBugIfInvariantHolds(StringRef Msg,
ErrorKind Error,
174 const Stmt *ValueExpr =
nullptr,
175 bool SuppressPath =
false)
const;
179 const Stmt *ValueExpr =
nullptr)
const {
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());
309 std::shared_ptr<PathDiagnosticPiece>
310 NullabilityChecker::NullabilityBugVisitor::VisitNode(
const ExplodedNode *N,
317 const NullabilityState *TrackedNullab = State->get<NullabilityMap>(Region);
318 const NullabilityState *TrackedNullabPrev =
319 StatePrev->get<NullabilityMap>(Region);
323 if (TrackedNullabPrev &&
324 TrackedNullabPrev->getValue() == TrackedNullab->getValue())
328 const Stmt *
S = TrackedNullab->getNullabilitySource();
336 std::string InfoText =
337 (llvm::Twine(
"Nullability '") +
338 getNullabilityString(TrackedNullab->getValue()) +
"' is inferred")
344 return std::make_shared<PathDiagnosticEventPiece>(Pos, InfoText,
true,
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>();
481 for (NullabilityMapTy::iterator
I = Nullabilities.begin(),
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);
616 OS << (RetExpr->getType()->isObjCObjectPointerType() ?
"nil" :
"Null");
618 " 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())
693 if (!Param->getType()->isAnyPointerType() &&
694 !Param->getType()->isReferenceType())
704 unsigned ParamIdx = Param->getFunctionScopeIndex() + 1;
706 if (Filter.CheckNullPassedToNonnull && Nullness == NullConstraint::IsNull &&
707 ArgExprTypeLevelNullability != Nullability::Nonnull &&
708 RequiredNullability == Nullability::Nonnull &&
709 isDiagnosableCall(Call)) {
715 llvm::raw_svector_ostream OS(SBuf);
716 OS << (Param->getType()->isObjCObjectPointerType() ?
"nil" :
"Null");
717 OS <<
" passed to a callee that requires a non-null " << ParamIdx
718 << llvm::getOrdinalSuffix(ParamIdx) <<
" parameter";
719 reportBugIfInvariantHolds(OS.str(), ErrorKind::NilPassedToNonnull, N,
725 const MemRegion *Region = getTrackRegion(*ArgSVal);
729 const NullabilityState *TrackedNullability =
730 State->get<NullabilityMap>(Region);
732 if (TrackedNullability) {
733 if (Nullness == NullConstraint::IsNotNull ||
737 if (Filter.CheckNullablePassedToNonnull &&
738 RequiredNullability == Nullability::Nonnull &&
739 isDiagnosableCall(Call)) {
742 llvm::raw_svector_ostream OS(SBuf);
743 OS <<
"Nullable pointer is passed to a callee that requires a non-null "
744 << ParamIdx << llvm::getOrdinalSuffix(ParamIdx) <<
" parameter";
745 reportBugIfInvariantHolds(OS.str(),
746 ErrorKind::NullablePassedToNonnull, N,
747 Region, C, ArgExpr,
true);
750 if (Filter.CheckNullableDereferenced &&
751 Param->getType()->isReferenceType()) {
753 reportBugIfInvariantHolds(
"Nullable pointer is dereferenced",
754 ErrorKind::NullableDereferenced, N, Region,
763 State = State->set<NullabilityMap>(
764 Region, NullabilityState(ArgExprTypeLevelNullability, ArgExpr));
766 if (State != OrigState)
771 void NullabilityChecker::checkPostCall(
const CallEvent &Call,
786 if (State->get<InvariantViolated>())
797 if (llvm::sys::path::filename(FilePath).startswith(
"CG")) {
798 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
803 const NullabilityState *TrackedNullability =
804 State->get<NullabilityMap>(Region);
806 if (!TrackedNullability &&
818 return Nullability::Nonnull;
826 if (Nullness == NullConstraint::IsNotNull)
827 return Nullability::Nonnull;
830 if (ValueRegionSVal) {
831 const MemRegion *SelfRegion = ValueRegionSVal->getRegion();
834 const NullabilityState *TrackedSelfNullability =
835 State->get<NullabilityMap>(SelfRegion);
836 if (TrackedSelfNullability)
837 return TrackedSelfNullability->getValue();
845 void NullabilityChecker::checkPostObjCMessage(
const ObjCMethodCall &M,
855 if (State->get<InvariantViolated>())
858 const MemRegion *ReturnRegion = getTrackRegion(M.getReturnValue());
862 auto Interface =
Decl->getClassInterface();
863 auto Name = Interface ? Interface->getName() :
"";
867 if (
Name.startswith(
"NS")) {
878 State->set<NullabilityMap>(ReturnRegion, Nullability::Contradicted);
884 if (
Name.find(
"Array") != StringRef::npos &&
885 (FirstSelectorSlot ==
"firstObject" ||
886 FirstSelectorSlot ==
"lastObject")) {
888 State->set<NullabilityMap>(ReturnRegion, Nullability::Contradicted);
897 if (
Name.find(
"String") != StringRef::npos) {
899 if (Param->getName() ==
"encoding") {
900 State = State->set<NullabilityMap>(ReturnRegion,
901 Nullability::Contradicted);
912 const NullabilityState *NullabilityOfReturn =
913 State->get<NullabilityMap>(ReturnRegion);
915 if (NullabilityOfReturn) {
919 Nullability RetValTracked = NullabilityOfReturn->getValue();
921 getMostNullable(RetValTracked, SelfNullability);
922 if (ComputedNullab != RetValTracked &&
924 const Stmt *NullabilitySource =
925 ComputedNullab == RetValTracked
926 ? NullabilityOfReturn->getNullabilitySource()
928 State = State->set<NullabilityMap>(
929 ReturnRegion, NullabilityState(ComputedNullab, NullabilitySource));
943 RetNullability = Nullability::Nonnull;
945 Nullability ComputedNullab = getMostNullable(RetNullability, SelfNullability);
947 const Stmt *NullabilitySource = ComputedNullab == RetNullability
950 State = State->set<NullabilityMap>(
951 ReturnRegion, NullabilityState(ComputedNullab, NullabilitySource));
970 if (State->get<InvariantViolated>())
982 const MemRegion *Region = getTrackRegion(*RegionSVal);
987 if (DestNullability == Nullability::Nonnull) {
989 if (Nullness == NullConstraint::IsNull) {
990 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
996 const NullabilityState *TrackedNullability =
997 State->get<NullabilityMap>(Region);
999 if (!TrackedNullability) {
1002 State = State->set<NullabilityMap>(Region,
1003 NullabilityState(DestNullability, CE));
1008 if (TrackedNullability->getValue() != DestNullability &&
1009 TrackedNullability->getValue() != Nullability::Contradicted) {
1010 State = State->set<NullabilityMap>(Region, Nullability::Contradicted);
1019 if (
auto *BinOp = dyn_cast<BinaryOperator>(S)) {
1020 if (BinOp->getOpcode() == BO_Assign)
1021 return BinOp->getRHS();
1025 if (
auto *DS = dyn_cast<DeclStmt>(S)) {
1026 if (DS->isSingleDecl()) {
1027 auto *VD = dyn_cast<
VarDecl>(DS->getSingleDecl());
1031 if (
const Expr *Init = VD->getInit())
1060 if (!DS || !DS->isSingleDecl())
1063 auto *VD = dyn_cast<
VarDecl>(DS->getSingleDecl());
1068 if(!VD->getType().getQualifiers().hasObjCLifetime())
1071 const Expr *Init = VD->getInit();
1072 assert(Init &&
"ObjC local under ARC without initializer");
1075 if (!isa<ImplicitValueInitExpr>(Init))
1083 void NullabilityChecker::checkBind(
SVal L,
SVal V,
const Stmt *S,
1086 dyn_cast_or_null<TypedValueRegion>(L.
getAsRegion());
1095 if (State->get<InvariantViolated>())
1099 if (!ValDefOrUnknown)
1105 if (
SymbolRef Sym = ValDefOrUnknown->getAsSymbol())
1115 ValueExprTypeLevelNullability =
1119 bool NullAssignedToNonNull = (LocNullability == Nullability::Nonnull &&
1120 RhsNullness == NullConstraint::IsNull);
1121 if (Filter.CheckNullPassedToNonnull &&
1122 NullAssignedToNonNull &&
1123 ValNullability != Nullability::Nonnull &&
1124 ValueExprTypeLevelNullability != Nullability::Nonnull &&
1132 const Stmt *ValueStmt =
S;
1134 ValueStmt = ValueExpr;
1137 llvm::raw_svector_ostream OS(SBuf);
1139 OS <<
" assigned to a pointer which is expected to have non-null value";
1140 reportBugIfInvariantHolds(OS.str(),
1141 ErrorKind::NilAssignedToNonnull, N,
nullptr, C,
1148 if (NullAssignedToNonNull) {
1149 State = State->set<InvariantViolated>(
true);
1157 const MemRegion *ValueRegion = getTrackRegion(*ValDefOrUnknown);
1161 const NullabilityState *TrackedNullability =
1162 State->get<NullabilityMap>(ValueRegion);
1164 if (TrackedNullability) {
1165 if (RhsNullness == NullConstraint::IsNotNull ||
1168 if (Filter.CheckNullablePassedToNonnull &&
1169 LocNullability == Nullability::Nonnull) {
1172 reportBugIfInvariantHolds(
"Nullable pointer is assigned to a pointer "
1173 "which is expected to have non-null value",
1174 ErrorKind::NullableAssignedToNonnull, N,
1185 const Stmt *NullabilitySource = BinOp ? BinOp->getRHS() :
S;
1186 State = State->set<NullabilityMap>(
1187 ValueRegion, NullabilityState(ValNullability, NullabilitySource));
1193 const Stmt *NullabilitySource = BinOp ? BinOp->getLHS() :
S;
1194 State = State->set<NullabilityMap>(
1195 ValueRegion, NullabilityState(LocNullability, NullabilitySource));
1200 void NullabilityChecker::printState(raw_ostream &Out,
ProgramStateRef State,
1201 const char *NL,
const char *Sep)
const {
1203 NullabilityMapTy B = State->get<NullabilityMap>();
1210 for (NullabilityMapTy::iterator
I = B.begin(),
E = B.end();
I !=
E; ++
I) {
1211 Out <<
I->first <<
" : ";
1212 I->second.print(Out);
1217 #define REGISTER_CHECKER(name, trackingRequired) \
1218 void ento::register##name##Checker(CheckerManager &mgr) { \
1219 NullabilityChecker *checker = mgr.registerChecker<NullabilityChecker>(); \
1220 checker->Filter.Check##name = true; \
1221 checker->Filter.CheckName##name = mgr.getCurrentCheckName(); \
1222 checker->NeedTracking = checker->NeedTracking || trackingRequired; \
1223 checker->NoDiagnoseCallsToSystemHeaders = \
1224 checker->NoDiagnoseCallsToSystemHeaders || \
1225 mgr.getAnalyzerOptions().getBooleanOption( \
1226 "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.
const char *const MemoryError
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. ...
Stmt - This represents one statement.
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...
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph).
virtual QualType getValueType() const =0
Decl - This represents one declaration (or definition), e.g.
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)
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
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.
static const Stmt * getStmt(const ExplodedNode *N)
Given an exploded node, retrieve the statement that should be used for the diagnostic location...
SourceLocation getLocStart() const LLVM_READONLY
#define REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, Type)
Declares a program state trait for type Type called Name, and introduce a typedef named NameTy...
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
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()
const FunctionType * getFunctionType(bool BlocksToo=true) const
Looks through the Decl's underlying type to extract a FunctionType when possible. ...
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.
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 isObjCObjectPointerType() const
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.
SourceLocation getLocStart() const LLVM_READONLY
This class handles loading and caching of source files into memory.
SourceManager & getSourceManager()
const LocationContext * getLocationContext() const