aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-28 00:50:51 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-28 00:50:51 +0000
commita1f81bb0e55749a1414b1b5124bb83b9052ff2ac (patch)
tree0c97cd43a55796c168142eaad7c1162b581e2017 /lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
parent166b7bd43551964d65bcf4918f51a167b8374e2a (diff)
[analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue.
This helper function (in the clang::ento::bugreporter namespace) may add more than one visitor, but conceptually it's tracking a single use of a null or undefined value and should do so as best it can. Also, the BugReport parameter has been made a reference to underscore that it is non-optional. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporterVisitors.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index a2d05852e8..a1b7e305e1 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -210,7 +210,7 @@ public:
llvm::tie(StNonZero, StZero) = State->assume(cast<DefinedSVal>(V));
if (StZero && !StNonZero) {
// If we're returning 0, we should track where that 0 came from.
- bugreporter::addTrackNullOrUndefValueVisitor(N, RetE, &BR);
+ bugreporter::trackNullOrUndefValue(N, RetE, BR);
if (isa<Loc>(V)) {
if (RetE->getType()->isObjCObjectPointerType())
@@ -435,9 +435,8 @@ TrackConstraintBRVisitor::VisitNode(const ExplodedNode *N,
return NULL;
}
-void bugreporter::addTrackNullOrUndefValueVisitor(const ExplodedNode *N,
- const Stmt *S,
- BugReport *report) {
+void bugreporter::trackNullOrUndefValue(const ExplodedNode *N, const Stmt *S,
+ BugReport &report) {
if (!S || !N)
return;
@@ -477,17 +476,17 @@ void bugreporter::addTrackNullOrUndefValueVisitor(const ExplodedNode *N,
// Mark both the variable region and its contents as interesting.
SVal V = state->getRawSVal(loc::MemRegionVal(R));
- report->markInteresting(R);
- report->markInteresting(V);
+ report.markInteresting(R);
+ report.markInteresting(V);
// If the contents are symbolic, find out when they became null.
if (V.getAsLocSymbol()) {
BugReporterVisitor *ConstraintTracker
= new TrackConstraintBRVisitor(cast<loc::MemRegionVal>(V), false);
- report->addVisitor(ConstraintTracker);
+ report.addVisitor(ConstraintTracker);
}
- report->addVisitor(new FindLastStoreBRVisitor(V, R));
+ report.addVisitor(new FindLastStoreBRVisitor(V, R));
return;
}
}
@@ -505,14 +504,14 @@ void bugreporter::addTrackNullOrUndefValueVisitor(const ExplodedNode *N,
if (loc::MemRegionVal *L = dyn_cast<loc::MemRegionVal>(&V)) {
const MemRegion *Base = L->getRegion()->getBaseRegion();
if (isa<SymbolicRegion>(Base)) {
- report->markInteresting(Base);
- report->addVisitor(new TrackConstraintBRVisitor(loc::MemRegionVal(Base),
+ report.markInteresting(Base);
+ report.addVisitor(new TrackConstraintBRVisitor(loc::MemRegionVal(Base),
false));
}
} else {
// Otherwise, if the value came from an inlined function call,
// we should at least make sure that function isn't pruned in our output.
- ReturnVisitor::addVisitorIfNecessary(N, S, *report);
+ ReturnVisitor::addVisitorIfNecessary(N, S, report);
}
}
@@ -555,7 +554,7 @@ PathDiagnosticPiece *NilReceiverBRVisitor::VisitNode(const ExplodedNode *N,
// The receiver was nil, and hence the method was skipped.
// Register a BugReporterVisitor to issue a message telling us how
// the receiver was null.
- bugreporter::addTrackNullOrUndefValueVisitor(N, Receiver, &BR);
+ bugreporter::trackNullOrUndefValue(N, Receiver, BR);
// Issue a message saying that the method was skipped.
PathDiagnosticLocation L(Receiver, BRC.getSourceManager(),
N->getLocationContext());