diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-03-30 19:53:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-03-30 19:53:37 +0000 |
commit | ac508988a5c9735f7a87aa6b871a2a03e250a6b6 (patch) | |
tree | c18623c8afab8a624a61c1a088a6468436927cc8 /clang/lib/Analysis/CheckNSError.cpp | |
parent | 169927e7ef2330d025bf754beef93aa6a27cfbda (diff) | |
download | bcm5719-llvm-ac508988a5c9735f7a87aa6b871a2a03e250a6b6.tar.gz bcm5719-llvm-ac508988a5c9735f7a87aa6b871a2a03e250a6b6.zip |
Simplify more code by using SVal::getAsSymbol().
llvm-svn: 68052
Diffstat (limited to 'clang/lib/Analysis/CheckNSError.cpp')
-rw-r--r-- | clang/lib/Analysis/CheckNSError.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Analysis/CheckNSError.cpp b/clang/lib/Analysis/CheckNSError.cpp index a35497a6bfd..ff9da0f659c 100644 --- a/clang/lib/Analysis/CheckNSError.cpp +++ b/clang/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 "; |