This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter
ClosedPublic

Authored by george.karpenkov on Sep 27 2018, 6:55 PM.

Diff Detail

Repository
rC Clang

Event Timeline

This goes through "core", but not through "checkers".
Also exposes quite a lot of dead code as a side effect.

I spent more them figuring out what these parameters are for than I'd like to admit. I especially like the cleanups in BugReporter! :)

NoQ accepted this revision.Sep 28 2018, 10:39 AM

I suspect that many of these will be brought back eventually, but i have specific plans for none of these, and when time comes we'll probably have a much better idea of what exactly do we need.

clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
305–306 ↗(On Diff #167422)

I think the idea behind N/PrevN was to attract the user's attention to the single correct way to write checker visitors:

if (N->getState()->get<CheckerTrait>(Something) != PrevN->getState()->get<CheckerTrait>(Something))
  return eventPieceThatExplainsWhatHappened();

Because writing visitors is mind-blowing if you don't know about this idiom. People instead try to pattern-match the getStmt(N) to see if this is a statement they've acted upon previously, which is shooting yourself in the foot. And if they see a PrevN, they'll guess that it must be there for a reason.

But i guess it's better to document it in some other way.

clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
534 ↗(On Diff #167422)

This parameter is there simply because all printing methods accept both NL and Sep, it's a common idiom around the codebase. They'll be brought back if printing becomes more complex.

2668 ↗(On Diff #167422)

I guess the bigger plan here is to erase the difference between checkPointerEscape and checkRegionChanges, and for that purpose we'd rather pass the parameter through to the checker than drop it. If we are instead to make a clear distinction between these callbacks, this change must be good. In any case, i don't have any specific plans.

clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
756–775 ↗(On Diff #167422)

Ugh, so this was dead all along? Yay.

This revision is now accepted and ready to land.Sep 28 2018, 10:39 AM
This revision was automatically updated to reflect the committed changes.