diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CFRefCount.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CFRefCount.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp index 7eb65cef198..80e11024119 100644 --- a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp +++ b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp @@ -34,11 +34,10 @@ #include "llvm/ADT/ImmutableMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" -#include <stdarg.h> +#include <cstdarg> using namespace clang; using namespace ento; -using llvm::StringRef; using llvm::StrInStrNoCase; namespace { @@ -305,10 +304,10 @@ public: ID.Add(T); } - void print(llvm::raw_ostream& Out) const; + void print(raw_ostream& Out) const; }; -void RefVal::print(llvm::raw_ostream& Out) const { +void RefVal::print(raw_ostream& Out) const { if (!T.isNull()) Out << "Tracked Type:" << T.getAsString() << '\n'; @@ -739,7 +738,7 @@ private: } Selector generateSelector(va_list argp) { - llvm::SmallVector<IdentifierInfo*, 10> II; + SmallVector<IdentifierInfo*, 10> II; while (const char* s = va_arg(argp, const char*)) II.push_back(&Ctx.Idents.get(s)); @@ -1654,7 +1653,7 @@ class CFRefCount : public TransferFuncs { public: class BindingsPrinter : public GRState::Printer { public: - virtual void Print(llvm::raw_ostream& Out, const GRState* state, + virtual void Print(raw_ostream& Out, const GRState* state, const char* nl, const char* sep); }; @@ -1684,10 +1683,10 @@ public: RefVal::Kind hasErr, SymbolRef Sym); const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, - llvm::SmallVectorImpl<SymbolRef> &Leaked); + SmallVectorImpl<SymbolRef> &Leaked); ExplodedNode* ProcessLeaks(const GRState * state, - llvm::SmallVectorImpl<SymbolRef> &Leaked, + SmallVectorImpl<SymbolRef> &Leaked, GenericNodeBuilderRefCount &Builder, ExprEngine &Eng, ExplodedNode *Pred = 0); @@ -1787,7 +1786,7 @@ public: } // end anonymous namespace -static void PrintPool(llvm::raw_ostream &Out, SymbolRef Sym, +static void PrintPool(raw_ostream &Out, SymbolRef Sym, const GRState *state) { Out << ' '; if (Sym) @@ -1804,7 +1803,7 @@ static void PrintPool(llvm::raw_ostream &Out, SymbolRef Sym, Out << '}'; } -void CFRefCount::BindingsPrinter::Print(llvm::raw_ostream& Out, +void CFRefCount::BindingsPrinter::Print(raw_ostream& Out, const GRState* state, const char* nl, const char* sep) { @@ -1844,7 +1843,7 @@ namespace { protected: CFRefCount& TF; - CFRefBug(CFRefCount* tf, llvm::StringRef name) + CFRefBug(CFRefCount* tf, StringRef name) : BugType(name, "Memory (Core Foundation/Objective-C)"), TF(*tf) {} public: @@ -1920,7 +1919,7 @@ namespace { class Leak : public CFRefBug { const bool isReturn; protected: - Leak(CFRefCount* tf, llvm::StringRef name, bool isRet) + Leak(CFRefCount* tf, StringRef name, bool isRet) : CFRefBug(tf, name), isReturn(isRet) {} public: @@ -1931,13 +1930,13 @@ namespace { class LeakAtReturn : public Leak { public: - LeakAtReturn(CFRefCount* tf, llvm::StringRef name) + LeakAtReturn(CFRefCount* tf, StringRef name) : Leak(tf, name, true) {} }; class LeakWithinFunction : public Leak { public: - LeakWithinFunction(CFRefCount* tf, llvm::StringRef name) + LeakWithinFunction(CFRefCount* tf, StringRef name) : Leak(tf, name, false) {} }; @@ -1955,7 +1954,7 @@ namespace { : RangedBugReport(D, D.getDescription(), n), Sym(sym), TF(tf) {} CFRefReport(CFRefBug& D, const CFRefCount &tf, - ExplodedNode *n, SymbolRef sym, llvm::StringRef endText) + ExplodedNode *n, SymbolRef sym, StringRef endText) : RangedBugReport(D, D.getDescription(), endText, n), Sym(sym), TF(tf) {} virtual ~CFRefReport() {} @@ -2036,9 +2035,9 @@ std::pair<const char**,const char**> CFRefReport::getExtraDescriptiveText() { } } -static inline bool contains(const llvm::SmallVectorImpl<ArgEffect>& V, +static inline bool contains(const SmallVectorImpl<ArgEffect>& V, ArgEffect X) { - for (llvm::SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end(); + for (SmallVectorImpl<ArgEffect>::const_iterator I=V.begin(), E=V.end(); I!=E; ++I) if (*I == X) return true; @@ -2114,7 +2113,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N, // Gather up the effects that were performed on the object at this // program point - llvm::SmallVector<ArgEffect, 2> AEffects; + SmallVector<ArgEffect, 2> AEffects; if (const RetainSummary *Summ = TF.getSummaryOfNode(BRC.getNodeResolver().getOriginalNode(N))) { @@ -2249,7 +2248,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N, } // Emit any remaining diagnostics for the argument effects (if any). - for (llvm::SmallVectorImpl<ArgEffect>::iterator I=AEffects.begin(), + for (SmallVectorImpl<ArgEffect>::iterator I=AEffects.begin(), E=AEffects.end(); I != E; ++I) { // A bunch of things have alternate behavior under GC. @@ -2555,7 +2554,7 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst, SourceRange ErrorRange; SymbolRef ErrorSym = 0; - llvm::SmallVector<const MemRegion*, 10> RegionsToInvalidate; + SmallVector<const MemRegion*, 10> RegionsToInvalidate; // Use RAII to make sure the whitelist is properly cleared. ResetWhiteList resetWhiteList; @@ -3309,7 +3308,7 @@ CFRefCount::HandleAutoreleaseCounts(const GRState * state, const GRState * CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, - llvm::SmallVectorImpl<SymbolRef> &Leaked) { + SmallVectorImpl<SymbolRef> &Leaked) { bool hasLeak = V.isOwned() || ((V.isNotOwned() || V.isReturnedOwned()) && V.getCount() > 0); @@ -3323,7 +3322,7 @@ CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V, ExplodedNode* CFRefCount::ProcessLeaks(const GRState * state, - llvm::SmallVectorImpl<SymbolRef> &Leaked, + SmallVectorImpl<SymbolRef> &Leaked, GenericNodeBuilderRefCount &Builder, ExprEngine& Eng, ExplodedNode *Pred) { @@ -3335,7 +3334,7 @@ CFRefCount::ProcessLeaks(const GRState * state, ExplodedNode *N = Builder.MakeNode(state, Pred); if (N) { - for (llvm::SmallVectorImpl<SymbolRef>::iterator + for (SmallVectorImpl<SymbolRef>::iterator I = Leaked.begin(), E = Leaked.end(); I != E; ++I) { CFRefBug *BT = static_cast<CFRefBug*>(Pred ? leakWithinFunction @@ -3368,7 +3367,7 @@ void CFRefCount::evalEndPath(ExprEngine& Eng, } B = state->get<RefBindings>(); - llvm::SmallVector<SymbolRef, 10> Leaked; + SmallVector<SymbolRef, 10> Leaked; for (RefBindings::iterator I = B.begin(), E = B.end(); I != E; ++I) state = HandleSymbolDeath(state, (*I).first, (*I).second, Leaked); @@ -3402,7 +3401,7 @@ void CFRefCount::evalDeadSymbols(ExplodedNodeSet& Dst, } B = state->get<RefBindings>(); - llvm::SmallVector<SymbolRef, 10> Leaked; + SmallVector<SymbolRef, 10> Leaked; for (SymbolReaper::dead_iterator I = SymReaper.dead_begin(), E = SymReaper.dead_end(); I != E; ++I) { @@ -3540,7 +3539,7 @@ void RetainReleaseChecker::checkPostStmt(const BlockExpr *BE, // FIXME: For now we invalidate the tracking of all symbols passed to blocks // via captured variables, even though captured variables result in a copy // and in implicit increment/decrement of a retain count. - llvm::SmallVector<const MemRegion*, 10> Regions; + SmallVector<const MemRegion*, 10> Regions; const LocationContext *LC = C.getPredecessor()->getLocationContext(); MemRegionManager &MemMgr = C.getSValBuilder().getRegionManager(); |