[analyzer] RetainCountChecker: remove untested, unused, incorrect option IncludeAllocationLine

The option has no tests, is not used anywhere, and is actually
incorrect: it prints the line number without the reference to a file,
which can be outright incorrect.

Differential Revision: https://reviews.llvm.org/D55385

llvm-svn: 348637
This commit is contained in:
George Karpenkov 2018-12-07 20:21:37 +00:00
parent a742193309
commit 936a9c978c
3 changed files with 7 additions and 17 deletions

View File

@ -1059,8 +1059,7 @@ ExplodedNode * RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S,
if (N) {
const LangOptions &LOpts = C.getASTContext().getLangOpts();
auto R = llvm::make_unique<CFRefLeakReport>(
*getLeakAtReturnBug(LOpts), LOpts, SummaryLog, N, Sym, C,
IncludeAllocationLine);
*getLeakAtReturnBug(LOpts), LOpts, SummaryLog, N, Sym, C);
C.emitReport(std::move(R));
}
return N;
@ -1346,7 +1345,7 @@ RetainCountChecker::processLeaks(ProgramStateRef state,
assert(BT && "BugType not initialized.");
Ctx.emitReport(llvm::make_unique<CFRefLeakReport>(
*BT, LOpts, SummaryLog, N, *I, Ctx, IncludeAllocationLine));
*BT, LOpts, SummaryLog, N, *I, Ctx));
}
}
@ -1508,8 +1507,6 @@ void ento::registerRetainCountChecker(CheckerManager &Mgr) {
AnalyzerOptions &Options = Mgr.getAnalyzerOptions();
Chk->IncludeAllocationLine = Options.getCheckerBooleanOption(
"leak-diagnostics-reference-allocation", false, Chk);
Chk->ShouldCheckOSObjectRetainCount = Options.getCheckerBooleanOption(
"CheckOSObject", true, Chk);
}

View File

@ -634,8 +634,7 @@ void CFRefLeakReport::deriveAllocLocation(CheckerContext &Ctx,
UniqueingDecl = AllocNode->getLocationContext()->getDecl();
}
void CFRefLeakReport::createDescription(CheckerContext &Ctx,
bool IncludeAllocationLine) {
void CFRefLeakReport::createDescription(CheckerContext &Ctx) {
assert(Location.isValid() && UniqueingDecl && UniqueingLocation.isValid());
Description.clear();
llvm::raw_string_ostream os(Description);
@ -644,10 +643,6 @@ void CFRefLeakReport::createDescription(CheckerContext &Ctx,
Optional<std::string> RegionDescription = describeRegion(AllocBinding);
if (RegionDescription) {
os << " stored into '" << *RegionDescription << '\'';
if (IncludeAllocationLine) {
FullSourceLoc SL(AllocStmt->getBeginLoc(), Ctx.getSourceManager());
os << " (allocated on line " << SL.getSpellingLineNumber() << ")";
}
} else {
// If we can't figure out the name, just supply the type information.
@ -658,15 +653,14 @@ void CFRefLeakReport::createDescription(CheckerContext &Ctx,
CFRefLeakReport::CFRefLeakReport(CFRefBug &D, const LangOptions &LOpts,
const SummaryLogTy &Log,
ExplodedNode *n, SymbolRef sym,
CheckerContext &Ctx,
bool IncludeAllocationLine)
CheckerContext &Ctx)
: CFRefReport(D, LOpts, Log, n, sym, false) {
deriveAllocLocation(Ctx, sym);
if (!AllocBinding)
deriveParamLocation(Ctx, sym);
createDescription(Ctx, IncludeAllocationLine);
createDescription(Ctx);
addVisitor(llvm::make_unique<CFRefLeakReportVisitor>(sym, Log));
}

View File

@ -71,13 +71,12 @@ class CFRefLeakReport : public CFRefReport {
// Finds the location where a leak warning for 'sym' should be raised.
void deriveAllocLocation(CheckerContext &Ctx, SymbolRef sym);
// Produces description of a leak warning which is printed on the console.
void createDescription(CheckerContext &Ctx, bool IncludeAllocationLine);
void createDescription(CheckerContext &Ctx);
public:
CFRefLeakReport(CFRefBug &D, const LangOptions &LOpts,
const SummaryLogTy &Log, ExplodedNode *n, SymbolRef sym,
CheckerContext &Ctx,
bool IncludeAllocationLine);
CheckerContext &Ctx);
PathDiagnosticLocation getLocation(const SourceManager &SM) const override {
assert(Location.isValid());