[cfe-commits] r146792 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Core/ProgramState.cpp

Anna Zaks ganna at apple.com
Fri Dec 16 16:26:29 PST 2011


Author: zaks
Date: Fri Dec 16 18:26:29 2011
New Revision: 146792

URL: http://llvm.org/viewvc/llvm-project?rev=146792&view=rev
Log:
[analyzer] Minor: Simplify & assert.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=146792&r1=146791&r2=146792&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Fri Dec 16 18:26:29 2011
@@ -34,7 +34,10 @@
     : Eng(eng),
       Pred(pred),
       Location(loc),
-      NB(builder) {}
+      NB(builder) {
+    assert(Pred->getState() &&
+           "We should not call the checkers on an empty state.");
+  }
 
   AnalysisManager &getAnalysisManager() {
     return Eng.getAnalysisManager();

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp?rev=146792&r1=146791&r2=146792&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp Fri Dec 16 18:26:29 2011
@@ -692,8 +692,8 @@
 bool ProgramState::isTainted(SVal V, TaintTagType Kind) const {
   if (const SymExpr *Sym = V.getAsSymExpr())
     return isTainted(Sym, Kind);
-  if (loc::MemRegionVal *RegVal = dyn_cast<loc::MemRegionVal>(&V))
-    return isTainted(RegVal->getRegion(), Kind);
+  if (const MemRegion *Reg = V.getAsRegion())
+    return isTainted(Reg, Kind);
   return false;
 }
 





More information about the cfe-commits mailing list