summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-10-16 00:30:08 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-10-16 00:30:08 +0000
commit4fba10c3940919ba7a845bd785e6e05262d671a1 (patch)
tree9adbbbfb8c6f764a1cf3e5f6775168c88d3cff4f /clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
parentae4c3e16999b9f5ae1932df7df188cd8b1e970fb (diff)
downloadbcm5719-llvm-4fba10c3940919ba7a845bd785e6e05262d671a1.tar.gz
bcm5719-llvm-4fba10c3940919ba7a845bd785e6e05262d671a1.zip
Revert "[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker""
Revert: r283662: [analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker" r283660: [analyzer] Fix build error after r283660 - remove constexpr strings. It was causing an internal build bot to fail. It looks like in some cases adding an extra note can cause scan-build plist output to drop a diagnostic altogether. llvm-svn: 284317
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp38
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;
OpenPOWER on IntegriCloud