aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngineInternalChecks.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-10-30 17:24:47 +0000
committerTed Kremenek <kremenek@apple.com>2009-10-30 17:24:47 +0000
commitbc3a021df7f9ee4c4d1e9ec3c2aac2ef6d883206 (patch)
treea12d858247d376c98698b692c2dd66d8762c8ea7 /lib/Analysis/GRExprEngineInternalChecks.cpp
parent3f7c7f48654230d8e379214cfe49fcf2fde0a2c6 (diff)
Move all logic for the null dereference checker from GRExprEngineInternalChecks.cpp to a separate .cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngineInternalChecks.cpp')
-rw-r--r--lib/Analysis/GRExprEngineInternalChecks.cpp47
1 files changed, 1 insertions, 46 deletions
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp
index 526bc93e85..81b465e532 100644
--- a/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -66,11 +66,6 @@ void BuiltinBug::Emit(BugReporter& BR, ITER I, ITER E) {
for (; I != E; ++I) BR.EmitReport(new BuiltinBugReport(*this, desc.c_str(),
GetNode(I)));
}
-void NullDeref::registerInitialVisitors(BugReporterContext& BRC,
- const ExplodedNode* N,
- BuiltinBugReport *R) {
- registerTrackNullOrUndefValue(BRC, bugreporter::GetDerefExpr(N), N);
-}
class VISIBILITY_HIDDEN NilReceiverStructRet : public BuiltinBug {
public:
@@ -794,48 +789,8 @@ ExplodedNode *CheckUndefDeref::CheckLocation(const Stmt *S, ExplodedNode *Pred,
return Pred;
}
-ExplodedNode *NullDerefChecker::CheckLocation(const Stmt *S, ExplodedNode *Pred,
- const GRState *state, SVal V,
- GRExprEngine &Eng) {
- Loc *LV = dyn_cast<Loc>(&V);
-
- // If the value is not a location, don't touch the node.
- if (!LV)
- return Pred;
-
- const GRState *NotNullState = state->Assume(*LV, true);
- const GRState *NullState = state->Assume(*LV, false);
-
- GRStmtNodeBuilder &Builder = Eng.getBuilder();
- BugReporter &BR = Eng.getBugReporter();
-
- // The explicit NULL case.
- if (NullState) {
- // Use the GDM to mark in the state what lval was null.
- const SVal *PersistentLV = Eng.getBasicVals().getPersistentSVal(*LV);
- NullState = NullState->set<GRState::NullDerefTag>(PersistentLV);
-
- ExplodedNode *N = Builder.generateNode(S, NullState, Pred,
- ProgramPoint::PostNullCheckFailedKind);
- if (N) {
- N->markAsSink();
-
- if (!NotNullState) { // Explicit null case.
- if (!BT)
- BT = new NullDeref();
- BR.EmitReport(new BuiltinBugReport(*BT,BT->getDescription().c_str(),N));
- return 0;
- } else // Implicit null case.
- ImplicitNullDerefNodes.push_back(N);
- }
- }
-
- if (!NotNullState)
- return 0;
- return Builder.generateNode(S, NotNullState, Pred,
- ProgramPoint::PostLocationChecksSucceedKind);
-}
} // end clang namespace
+
//===----------------------------------------------------------------------===//
// Check registration.
//===----------------------------------------------------------------------===//