aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CheckNSError.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-30 19:53:37 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-30 19:53:37 +0000
commit93e71455e932fb6436a154e2c805395558b7d54c (patch)
tree541b06902cec6a4bc245e3c44487ec8925a142f4 /lib/Analysis/CheckNSError.cpp
parent380022d9072ebc3b2b1050098be6da8de4d03e0e (diff)
Simplify more code by using SVal::getAsSymbol().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CheckNSError.cpp')
-rw-r--r--lib/Analysis/CheckNSError.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp
index a35497a6bf..ff9da0f659 100644
--- a/lib/Analysis/CheckNSError.cpp
+++ b/lib/Analysis/CheckNSError.cpp
@@ -194,11 +194,11 @@ void NSErrorCheck::CheckParamDeref(VarDecl* Param, GRStateRef rootState,
assert (ParamR && "Parameters always have VarRegions.");
SVal ParamSVal = rootState.GetSVal(ParamR);
-
// FIXME: For now assume that ParamSVal is symbolic. We need to generalize
// this later.
- loc::SymbolVal* SV = dyn_cast<loc::SymbolVal>(&ParamSVal);
- if (!SV) return;
+ SymbolRef ParamSym = ParamSVal.getAsLocSymbol();
+ if (!ParamSym)
+ return;
// Iterate over the implicit-null dereferences.
for (GRExprEngine::null_deref_iterator I=Eng.implicit_null_derefs_begin(),
@@ -206,13 +206,11 @@ void NSErrorCheck::CheckParamDeref(VarDecl* Param, GRStateRef rootState,
GRStateRef state = GRStateRef((*I)->getState(), Eng.getStateManager());
const SVal* X = state.get<GRState::NullDerefTag>();
- const loc::SymbolVal* SVX = dyn_cast_or_null<loc::SymbolVal>(X);
- if (!SVX || SVX->getSymbol() != SV->getSymbol()) continue;
-
- // Emit an error.
-
+ if (!X || X->getAsSymbol() != ParamSym)
+ continue;
+ // Emit an error.
std::string sbuf;
llvm::raw_string_ostream os(sbuf);
os << "Potential null dereference. According to coding standards ";