diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-09-28 18:49:41 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-09-28 18:49:41 +0000 |
commit | b0be6606a0a2abe9bd201e24bac771e572d37031 (patch) | |
tree | 8ab01bf5d34aa79817666c9003ef3651687df200 /lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | 08f8ea6bafa1e45d42a4b5023ef2e2b99d6276b4 (diff) | |
download | clang-b0be6606a0a2abe9bd201e24bac771e572d37031.tar.gz |
[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter
Differential Revision: https://reviews.llvm.org/D52640
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index bc4600c827..8899fa67a3 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -861,8 +861,7 @@ static void reversePropagateIntererstingSymbols(BugReport &R, static void reversePropagateInterestingSymbols(BugReport &R, InterestingExprs &IE, const ProgramState *State, - const LocationContext *CalleeCtx, - const LocationContext *CallerCtx) + const LocationContext *CalleeCtx) { // FIXME: Handle non-CallExpr-based CallEvents. const StackFrameContext *Callee = CalleeCtx->getStackFrame(); @@ -967,8 +966,7 @@ static bool isInLoopBody(ParentMap &PM, const Stmt *S, const Stmt *Term) { /// Adds a sanitized control-flow diagnostic edge to a path. static void addEdgeToPath(PathPieces &path, PathDiagnosticLocation &PrevLoc, - PathDiagnosticLocation NewLoc, - const LocationContext *LC) { + PathDiagnosticLocation NewLoc) { if (!NewLoc.isValid()) return; @@ -1043,7 +1041,7 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, // not from declaration. if (D->hasBody()) addEdgeToPath(PD.getActivePath(), PrevLoc, - PathDiagnosticLocation::createBegin(D, SM), CalleeLC); + PathDiagnosticLocation::createBegin(D, SM)); } // Did we visit an entire call? @@ -1108,7 +1106,7 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, // We are descending into a call (backwards). Construct // a new call piece to contain the path pieces for that call. - auto C = PathDiagnosticCallPiece::construct(N, *CE, SM); + auto C = PathDiagnosticCallPiece::construct(*CE, SM); // Record the mapping from call piece to LocationContext. LCM[&C->path] = CE->getCalleeContext(); @@ -1121,7 +1119,7 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, N->getLocationContext()); } // Add the edge to the return site. - addEdgeToPath(PD.getActivePath(), PrevLoc, C->callReturn, PDB.LC); + addEdgeToPath(PD.getActivePath(), PrevLoc, C->callReturn); PrevLoc.invalidate(); } @@ -1151,7 +1149,7 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, if (!isa<ObjCForCollectionStmt>(PS->getStmt())) { PathDiagnosticLocation L = PathDiagnosticLocation(PS->getStmt(), SM, PDB.LC); - addEdgeToPath(PD.getActivePath(), PrevLoc, L, PDB.LC); + addEdgeToPath(PD.getActivePath(), PrevLoc, L); } } else if (auto BE = P.getAs<BlockEdge>()) { @@ -1168,8 +1166,7 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, const LocationContext *CalleeCtx = PDB.LC; if (CallerCtx != CalleeCtx && AddPathEdges) { reversePropagateInterestingSymbols(*PDB.getBugReport(), IE, - N->getState().get(), - CalleeCtx, CallerCtx); + N->getState().get(), CalleeCtx); } } @@ -1194,13 +1191,12 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, "of the loop"); p->setPrunable(true); - addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), PDB.LC); + addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation()); PD.getActivePath().push_front(std::move(p)); if (const auto *CS = dyn_cast_or_null<CompoundStmt>(Body)) { addEdgeToPath(PD.getActivePath(), PrevLoc, - PathDiagnosticLocation::createEndBrace(CS, SM), - PDB.LC); + PathDiagnosticLocation::createEndBrace(CS, SM)); } } @@ -1236,13 +1232,13 @@ static void generatePathDiagnosticsForNode(const ExplodedNode *N, auto PE = std::make_shared<PathDiagnosticEventPiece>(L, str); PE->setPrunable(true); addEdgeToPath(PD.getActivePath(), PrevLoc, - PE->getLocation(), PDB.LC); + PE->getLocation()); PD.getActivePath().push_front(std::move(PE)); } } else if (isa<BreakStmt>(Term) || isa<ContinueStmt>(Term) || isa<GotoStmt>(Term)) { PathDiagnosticLocation L(Term, SM, PDB.LC); - addEdgeToPath(PD.getActivePath(), PrevLoc, L, PDB.LC); + addEdgeToPath(PD.getActivePath(), PrevLoc, L); } } } @@ -1540,8 +1536,7 @@ static Optional<size_t> getLengthOnSingleLine(SourceManager &SM, /// - if there is an inlined call between the edges instead of a single event. /// - if the whole statement is large enough that having subexpression arrows /// might be helpful. -static void removeContextCycles(PathPieces &Path, SourceManager &SM, - ParentMap &PM) { +static void removeContextCycles(PathPieces &Path, SourceManager &SM) { for (PathPieces::iterator I = Path.begin(), E = Path.end(); I != E; ) { // Pattern match the current piece and its successor. const auto *PieceI = dyn_cast<PathDiagnosticControlFlowPiece>(I->get()); @@ -1844,7 +1839,7 @@ static bool optimizeEdges(PathPieces &path, SourceManager &SM, // and aesthetically pleasing. addContextEdges(path, SM, PM, LC); // Remove "cyclical" edges that include one or more context edges. - removeContextCycles(path, SM, PM); + removeContextCycles(path, SM); // Hoist edges originating from branch conditions to branches // for simple branches. simplifySimpleBranches(path); @@ -1962,8 +1957,7 @@ static std::unique_ptr<PathDiagnostic> generatePathDiagnosticForConsumer( continue; if (AddPathEdges) - addEdgeToPath(PD->getActivePath(), PrevLoc, Note->getLocation(), - PDB.LC); + addEdgeToPath(PD->getActivePath(), PrevLoc, Note->getLocation()); updateStackPiecesWithMessage(*Note, CallStack); PD->getActivePath().push_front(Note); } @@ -1975,7 +1969,7 @@ static std::unique_ptr<PathDiagnostic> generatePathDiagnosticForConsumer( const StackFrameContext *CalleeLC = PDB.LC->getStackFrame(); const Decl *D = CalleeLC->getDecl(); addEdgeToPath(PD->getActivePath(), PrevLoc, - PathDiagnosticLocation::createBegin(D, SM), CalleeLC); + PathDiagnosticLocation::createBegin(D, SM)); } if (!AddPathEdges && GenerateDiagnostics) @@ -2574,7 +2568,7 @@ generateVisitorsDiagnostics(BugReport *R, const ExplodedNode *ErrorNode, } for (auto &V : visitors) { - auto P = V->VisitNode(NextNode, Pred, BRC, *R); + auto P = V->VisitNode(NextNode, BRC, *R); if (P) (*Notes)[NextNode].push_back(std::move(P)); } |