summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-10-04 02:36:58 +0000
committerVitaly Buka <vitalybuka@google.com>2016-10-04 02:36:58 +0000
commitb3814f6f38cc0b3d0d9662c01b8a6d49a6543219 (patch)
tree0ae71174ad50d3b16f2dbcb6728d6a44a32377ed /clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
parent20efb97ff36aec70f2017ac58aa71cfc90f84e9a (diff)
downloadbcm5719-llvm-b3814f6f38cc0b3d0d9662c01b8a6d49a6543219.tar.gz
bcm5719-llvm-b3814f6f38cc0b3d0d9662c01b8a6d49a6543219.zip
Revert "[analyzer] Add extra notes to ObjCDeallocChecker" as its depends on reverted r283092
This reverts commit r283093. llvm-svn: 283181
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index 8fd36b82866..ffb0adc8d63 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -107,9 +107,6 @@ class ObjCDeallocChecker
std::unique_ptr<BugType> ExtraReleaseBugType;
std::unique_ptr<BugType> MistakenDeallocBugType;
- static constexpr const char *MsgDeclared = "Property is declared here";
- static constexpr const char *MsgSynthesized = "Property is synthesized here";
-
public:
ObjCDeallocChecker();
@@ -131,9 +128,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,
@@ -495,18 +489,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 {
@@ -604,9 +586,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));
}
@@ -710,12 +689,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 ";
@@ -732,10 +710,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;
OpenPOWER on IntegriCloud