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

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 12:25:21 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC348637: [analyzer] RetainCountChecker: remove untested, unused, incorrect option… (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55385?vs=177055&id=177275#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55385/new/

https://reviews.llvm.org/D55385

Files:
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h


Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -634,8 +634,7 @@
   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 @@
   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 @@
 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));
 }
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -1059,8 +1059,7 @@
         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 @@
       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 @@
 
   AnalyzerOptions &Options = Mgr.getAnalyzerOptions();
 
-  Chk->IncludeAllocationLine = Options.getCheckerBooleanOption(
-                           "leak-diagnostics-reference-allocation", false, Chk);
   Chk->ShouldCheckOSObjectRetainCount = Options.getCheckerBooleanOption(
                                                     "CheckOSObject", true, Chk);
 }
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
@@ -71,13 +71,12 @@
   // 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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55385.177275.patch
Type: text/x-patch
Size: 4305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181207/4bd66798/attachment.bin>


More information about the cfe-commits mailing list