diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp index 1c8ca0f4295..2818c9d9fd4 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -108,10 +108,6 @@ class ObjCDeallocChecker std::unique_ptr<BugType> ExtraReleaseBugType; std::unique_ptr<BugType> MistakenDeallocBugType; - // FIXME: constexpr initialization isn't supported by MSVC2013. - static const char *const MsgDeclared; - static const char *const MsgSynthesized; - public: ObjCDeallocChecker(); @@ -133,9 +129,6 @@ public: void checkEndFunction(CheckerContext &Ctx) const; private: - void addNoteForDecl(std::unique_ptr<BugReport> &BR, StringRef Msg, - const Decl *D) const; - void diagnoseMissingReleases(CheckerContext &C) const; bool diagnoseExtraRelease(SymbolRef ReleasedValue, const ObjCMethodCall &M, @@ -187,11 +180,6 @@ private: typedef llvm::ImmutableSet<SymbolRef> SymbolSet; -const char *const ObjCDeallocChecker::MsgDeclared = - "Property is declared here"; -const char *const ObjCDeallocChecker::MsgSynthesized = - "Property is synthesized here"; - /// Maps from the symbol for a class instance to the set of /// symbols remaining that must be released in -dealloc. REGISTER_MAP_WITH_PROGRAMSTATE(UnreleasedIvarMap, SymbolRef, SymbolSet) @@ -503,18 +491,6 @@ ProgramStateRef ObjCDeallocChecker::checkPointerEscape( return State; } -/// Add an extra note piece describing a declaration that is important -/// for understanding the bug report. -void ObjCDeallocChecker::addNoteForDecl(std::unique_ptr<BugReport> &BR, - StringRef Msg, - const Decl *D) const { - ASTContext &ACtx = D->getASTContext(); - SourceManager &SM = ACtx.getSourceManager(); - PathDiagnosticLocation Pos = PathDiagnosticLocation::createBegin(D, SM); - if (Pos.isValid() && Pos.asLocation().isValid()) - BR->addNote(Msg, Pos, D->getSourceRange()); -} - /// Report any unreleased instance variables for the current instance being /// dealloced. void ObjCDeallocChecker::diagnoseMissingReleases(CheckerContext &C) const { @@ -612,9 +588,6 @@ void ObjCDeallocChecker::diagnoseMissingReleases(CheckerContext &C) const { std::unique_ptr<BugReport> BR( new BugReport(*MissingReleaseBugType, OS.str(), ErrNode)); - addNoteForDecl(BR, MsgDeclared, PropDecl); - addNoteForDecl(BR, MsgSynthesized, PropImpl); - C.emitReport(std::move(BR)); } @@ -718,12 +691,11 @@ bool ObjCDeallocChecker::diagnoseExtraRelease(SymbolRef ReleasedValue, ); const ObjCImplDecl *Container = getContainingObjCImpl(C.getLocationContext()); - const ObjCIvarDecl *IvarDecl = PropImpl->getPropertyIvarDecl(); - OS << "The '" << *IvarDecl << "' ivar in '" << *Container; + OS << "The '" << *PropImpl->getPropertyIvarDecl() + << "' ivar in '" << *Container; - bool ReleasedByCIFilterDealloc = isReleasedByCIFilterDealloc(PropImpl); - if (ReleasedByCIFilterDealloc) { + if (isReleasedByCIFilterDealloc(PropImpl)) { OS << "' will be released by '-[CIFilter dealloc]' but also released here"; } else { OS << "' was synthesized for "; @@ -740,10 +712,6 @@ bool ObjCDeallocChecker::diagnoseExtraRelease(SymbolRef ReleasedValue, new BugReport(*ExtraReleaseBugType, OS.str(), ErrNode)); BR->addRange(M.getOriginExpr()->getSourceRange()); - addNoteForDecl(BR, MsgDeclared, PropDecl); - if (!ReleasedByCIFilterDealloc) - addNoteForDecl(BR, MsgSynthesized, PropImpl); - C.emitReport(std::move(BR)); return true; |