diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-05-27 02:45:47 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-05-27 02:45:47 +0000 |
commit | 0dbb783c7be1756482c491b3635dd07dd5fe712c (patch) | |
tree | 477bfcd6d42f6152fccaed23f0f20730b629da2a /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | 7b15cf888453aa9d0828b6121f7bd05138f8fe0a (diff) | |
download | bcm5719-llvm-0dbb783c7be1756482c491b3635dd07dd5fe712c.tar.gz bcm5719-llvm-0dbb783c7be1756482c491b3635dd07dd5fe712c.zip |
[C++11] Use 'nullptr'. StaticAnalyzer edition.
llvm-svn: 209642
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index d312b0199ae..0c130fe833b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -451,10 +451,10 @@ public: : II(ii), S(s) {} ObjCSummaryKey(const ObjCInterfaceDecl *d, Selector s) - : II(d ? d->getIdentifier() : 0), S(s) {} + : II(d ? d->getIdentifier() : nullptr), S(s) {} ObjCSummaryKey(Selector s) - : II(0), S(s) {} + : II(nullptr), S(s) {} IdentifierInfo *getIdentifier() const { return II; } Selector getSelector() const { return S; } @@ -503,7 +503,7 @@ public: if (I != M.end()) return I->second; if (!D) - return NULL; + return nullptr; // Walk the super chain. If we find a hit with a parent, we'll end // up returning that summary. We actually allow that key (null,S), as @@ -516,7 +516,7 @@ public: break; if (!C) - return NULL; + return nullptr; } // Cache the summary with original key to make the next lookup faster @@ -534,7 +534,7 @@ public: if (I == M.end()) I = M.find(ObjCSummaryKey(S)); - return I == M.end() ? NULL : I->second; + return I == M.end() ? nullptr : I->second; } const RetainSummary *& operator[](ObjCSummaryKey K) { @@ -723,7 +723,7 @@ public: } const RetainSummary *getSummary(const CallEvent &Call, - ProgramStateRef State = 0); + ProgramStateRef State = nullptr); const RetainSummary *getFunctionSummary(const FunctionDecl *FD); @@ -1006,7 +1006,7 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) { return I->second; // No summary? Generate one. - const RetainSummary *S = 0; + const RetainSummary *S = nullptr; bool AllowAnnotations = true; do { @@ -1447,7 +1447,7 @@ RetainSummaryManager::getStandardMethodSummary(const ObjCMethodDecl *MD, const RetainSummary * RetainSummaryManager::getInstanceMethodSummary(const ObjCMethodCall &Msg, ProgramStateRef State) { - const ObjCInterfaceDecl *ReceiverClass = 0; + const ObjCInterfaceDecl *ReceiverClass = nullptr; // We do better tracking of the type of the object than the core ExprEngine. // See if we have its type in our private state. @@ -1788,7 +1788,7 @@ namespace { void CFRefReport::addGCModeDescription(const LangOptions &LOpts, bool GCEnabled) { - const char *GCModeDescription = 0; + const char *GCModeDescription = nullptr; switch (LOpts.getGC()) { case LangOptions::GCOnly: @@ -1835,7 +1835,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, // FIXME: We will eventually need to handle non-statement-based events // (__attribute__((cleanup))). if (!N->getLocation().getAs<StmtPoint>()) - return NULL; + return nullptr; // Check if the type state has changed. ProgramStateRef PrevSt = PrevN->getState(); @@ -1843,7 +1843,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, const LocationContext *LCtx = N->getLocationContext(); const RefVal* CurrT = getRefBinding(CurrSt, Sym); - if (!CurrT) return NULL; + if (!CurrT) return nullptr; const RefVal &CurrV = *CurrT; const RefVal *PrevT = getRefBinding(PrevSt, Sym); @@ -1868,7 +1868,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, if (isNumericLiteralExpression(BL->getSubExpr())) os << "NSNumber literal is an object with a +0 retain count"; else { - const ObjCInterfaceDecl *BoxClass = 0; + const ObjCInterfaceDecl *BoxClass = nullptr; if (const ObjCMethodDecl *Method = BL->getBoxingMethod()) BoxClass = Method->getClassInterface(); @@ -2037,7 +2037,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, if (PrevV.getCount() == CurrV.getCount()) { // Did an autorelease message get sent? if (PrevV.getAutoreleaseCount() == CurrV.getAutoreleaseCount()) - return 0; + return nullptr; assert(PrevV.getAutoreleaseCount() < CurrV.getAutoreleaseCount()); os << "Object autoreleased"; @@ -2067,7 +2067,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, case RefVal::ReturnedOwned: // Autoreleases can be applied after marking a node ReturnedOwned. if (CurrV.getAutoreleaseCount()) - return NULL; + return nullptr; os << "Object returned to caller as an owning reference (single " "retain count transferred to caller)"; @@ -2078,7 +2078,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, break; default: - return NULL; + return nullptr; } // Emit any remaining diagnostics for the argument effects (if any). @@ -2103,7 +2103,7 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, } while (0); if (os.str().empty()) - return 0; // We have nothing to say! + return nullptr; // We have nothing to say! const Stmt *S = N->getLocation().castAs<StmtPoint>().getStmt(); PathDiagnosticLocation Pos(S, BRC.getSourceManager(), @@ -2143,12 +2143,12 @@ GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, SymbolRef Sym) { const ExplodedNode *AllocationNode = N; const ExplodedNode *AllocationNodeInCurrentContext = N; - const MemRegion* FirstBinding = 0; + const MemRegion *FirstBinding = nullptr; const LocationContext *LeakContext = N->getLocationContext(); // The location context of the init method called on the leaked object, if // available. - const LocationContext *InitMethodContext = 0; + const LocationContext *InitMethodContext = nullptr; while (N) { ProgramStateRef St = N->getState(); @@ -2192,12 +2192,12 @@ GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, } } - N = N->pred_empty() ? NULL : *(N->pred_begin()); + N = N->pred_empty() ? nullptr : *(N->pred_begin()); } // If we are reporting a leak of the object that was allocated with alloc, // mark its init method as interesting. - const LocationContext *InterestingMethodContext = 0; + const LocationContext *InterestingMethodContext = nullptr; if (InitMethodContext) { const ProgramPoint AllocPP = AllocationNode->getLocation(); if (Optional<StmtPoint> SP = AllocPP.getAs<StmtPoint>()) @@ -2210,7 +2210,7 @@ GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, // do not report the binding. assert(N && "Could not find allocation node"); if (N->getLocationContext() != LeakContext) { - FirstBinding = 0; + FirstBinding = nullptr; } return AllocationInfo(AllocationNodeInCurrentContext, @@ -2327,7 +2327,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug &D, const LangOptions &LOpts, // Note that this is *not* the trimmed graph; we are guaranteed, however, // that all ancestor nodes that represent the allocation site have the // same SourceLocation. - const ExplodedNode *AllocNode = 0; + const ExplodedNode *AllocNode = nullptr; const SourceManager& SMgr = Ctx.getSourceManager(); @@ -2602,7 +2602,7 @@ public: ExplodedNode *processLeaks(ProgramStateRef state, SmallVectorImpl<SymbolRef> &Leaked, CheckerContext &Ctx, - ExplodedNode *Pred = 0) const; + ExplodedNode *Pred = nullptr) const; }; } // end anonymous namespace @@ -2886,7 +2886,7 @@ void RetainCountChecker::checkSummary(const RetainSummary &Summ, // Evaluate the effect of the arguments. RefVal::Kind hasErr = (RefVal::Kind) 0; SourceRange ErrorRange; - SymbolRef ErrorSym = 0; + SymbolRef ErrorSym = nullptr; for (unsigned idx = 0, e = CallOrMsg.getNumArgs(); idx != e; ++idx) { SVal V = CallOrMsg.getArgSVal(idx); @@ -3242,7 +3242,7 @@ bool RetainCountChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { if (RetVal.isUnknown()) { // If the receiver is unknown, conjure a return value. SValBuilder &SVB = C.getSValBuilder(); - RetVal = SVB.conjureSymbolVal(0, CE, LCtx, ResultTy, C.blockCount()); + RetVal = SVB.conjureSymbolVal(nullptr, CE, LCtx, ResultTy, C.blockCount()); } state = state->BindExpr(CE, LCtx, RetVal, false); @@ -3251,7 +3251,7 @@ bool RetainCountChecker::evalCall(const CallExpr *CE, CheckerContext &C) const { if (const MemRegion *ArgRegion = RetVal.getAsRegion()) { // Save the refcount status of the argument. SymbolRef Sym = RetVal.getAsLocSymbol(); - const RefVal *Binding = 0; + const RefVal *Binding = nullptr; if (Sym) Binding = getRefBinding(state, Sym); @@ -3622,7 +3622,7 @@ RetainCountChecker::handleAutoreleaseCounts(ProgramStateRef state, Ctx.emitReport(report); } - return 0; + return nullptr; } ProgramStateRef @@ -3683,7 +3683,7 @@ void RetainCountChecker::checkEndFunction(CheckerContext &Ctx) const { } for (RefBindingsTy::iterator I = B.begin(), E = B.end(); I != E; ++I) { - state = handleAutoreleaseCounts(state, Pred, /*Tag=*/0, Ctx, + state = handleAutoreleaseCounts(state, Pred, /*Tag=*/nullptr, Ctx, I->first, I->second); if (!state) return; |