[cfe-commits] r111113 - in /cfe/trunk: include/clang/Checker/PathSensitive/GRState.h lib/Checker/GRState.cpp

Jordy Rose jediknil at belkadan.com
Sun Aug 15 15:19:34 PDT 2010


Author: jrose
Date: Sun Aug 15 17:19:33 2010
New Revision: 111113

URL: http://llvm.org/viewvc/llvm-project?rev=111113&view=rev
Log:
Move GRState's bind* methods out of its header file -- they're too big for inlining now.

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/GRState.h
    cfe/trunk/lib/Checker/GRState.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRState.h?rev=111113&r1=111112&r2=111113&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRState.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRState.h Sun Aug 15 17:19:33 2010
@@ -16,7 +16,6 @@
 
 #include "clang/Checker/PathSensitive/ConstraintManager.h"
 #include "clang/Checker/PathSensitive/Environment.h"
-#include "clang/Checker/PathSensitive/GRSubEngine.h"
 #include "clang/Checker/PathSensitive/Store.h"
 #include "clang/Checker/PathSensitive/ValueManager.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -624,85 +623,10 @@
                            cast<DefinedSVal>(UpperBound), Assumption);
 }
 
-inline const GRState *
-GRState::bindCompoundLiteral(const CompoundLiteralExpr* CL,
-                             const LocationContext *LC,
-                             SVal V) const {
-  Store new_store = 
-    getStateManager().StoreMgr->BindCompoundLiteral(St, CL, LC, V);
-  return makeWithStore(new_store);
-}
-
-inline const GRState *GRState::bindDecl(const VarRegion* VR, SVal IVal) const {
-  Store new_store = getStateManager().StoreMgr->BindDecl(St, VR, IVal);
-  return makeWithStore(new_store);
-}
-
-inline const GRState *GRState::bindDeclWithNoInit(const VarRegion* VR) const {
-  Store new_store = getStateManager().StoreMgr->BindDeclWithNoInit(St, VR);
-  return makeWithStore(new_store);
-}
-
-inline const GRState *GRState::bindLoc(Loc LV, SVal V) const {
-  GRStateManager &Mgr = getStateManager();
-  Store new_store = Mgr.StoreMgr->Bind(St, LV, V);
-  const GRState *new_state = makeWithStore(new_store);
-
-  const MemRegion *MR = LV.getAsRegion();
-  if (MR)
-    return Mgr.getOwningEngine().ProcessRegionChange(new_state, MR);
-
-  return new_state;
-}
-
 inline const GRState *GRState::bindLoc(SVal LV, SVal V) const {
   return !isa<Loc>(LV) ? this : bindLoc(cast<Loc>(LV), V);
 }
 
-inline const GRState *GRState::bindDefault(SVal loc, SVal V) const {
-  GRStateManager &Mgr = getStateManager();
-  const MemRegion *R = cast<loc::MemRegionVal>(loc).getRegion();
-  Store new_store = Mgr.StoreMgr->BindDefault(St, R, V);
-  const GRState *new_state = makeWithStore(new_store);
-  return Mgr.getOwningEngine().ProcessRegionChange(new_state, R);
-}
-
-inline const GRState *
-GRState::InvalidateRegions(const MemRegion * const *Begin,
-                           const MemRegion * const *End,
-                           const Expr *E, unsigned Count,
-                           StoreManager::InvalidatedSymbols *IS,
-                           bool invalidateGlobals) const {
-  GRStateManager &Mgr = getStateManager();
-  GRSubEngine &Eng = Mgr.getOwningEngine();
-
-  if (Eng.WantsRegionChangeUpdate(this)) {
-    StoreManager::InvalidatedRegions Regions;
-
-    Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
-                                                      E, Count, IS,
-                                                      invalidateGlobals,
-                                                      &Regions);
-    const GRState *new_state = makeWithStore(new_store);
-
-    return Eng.ProcessRegionChanges(new_state,
-                                    &Regions.front(),
-                                    &Regions.back()+1);
-  }
-
-  Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
-                                                    E, Count, IS,
-                                                    invalidateGlobals,
-                                                    NULL);
-  return makeWithStore(new_store);
-}
-
-inline const GRState *
-GRState::EnterStackFrame(const StackFrameContext *frame) const {
-  Store new_store = getStateManager().StoreMgr->EnterStackFrame(this, frame);
-  return makeWithStore(new_store);
-}
-
 inline Loc GRState::getLValue(const VarDecl* VD,
                                const LocationContext *LC) const {
   return getStateManager().StoreMgr->getLValueVar(VD, LC);

Modified: cfe/trunk/lib/Checker/GRState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRState.cpp?rev=111113&r1=111112&r2=111113&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRState.cpp (original)
+++ cfe/trunk/lib/Checker/GRState.cpp Sun Aug 15 17:19:33 2010
@@ -14,6 +14,7 @@
 #include "clang/Analysis/CFG.h"
 #include "clang/Checker/PathSensitive/GRStateTrait.h"
 #include "clang/Checker/PathSensitive/GRState.h"
+#include "clang/Checker/PathSensitive/GRSubEngine.h"
 #include "clang/Checker/PathSensitive/GRTransferFuncs.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -68,6 +69,73 @@
   return getPersistentState(State);
 }
 
+const GRState *GRState::bindCompoundLiteral(const CompoundLiteralExpr* CL,
+                                            const LocationContext *LC,
+                                            SVal V) const {
+  Store new_store = 
+    getStateManager().StoreMgr->BindCompoundLiteral(St, CL, LC, V);
+  return makeWithStore(new_store);
+}
+
+const GRState *GRState::bindDecl(const VarRegion* VR, SVal IVal) const {
+  Store new_store = getStateManager().StoreMgr->BindDecl(St, VR, IVal);
+  return makeWithStore(new_store);
+}
+
+const GRState *GRState::bindDeclWithNoInit(const VarRegion* VR) const {
+  Store new_store = getStateManager().StoreMgr->BindDeclWithNoInit(St, VR);
+  return makeWithStore(new_store);
+}
+
+const GRState *GRState::bindLoc(Loc LV, SVal V) const {
+  GRStateManager &Mgr = getStateManager();
+  Store new_store = Mgr.StoreMgr->Bind(St, LV, V);
+  const GRState *new_state = makeWithStore(new_store);
+
+  const MemRegion *MR = LV.getAsRegion();
+  if (MR)
+    return Mgr.getOwningEngine().ProcessRegionChange(new_state, MR);
+
+  return new_state;
+}
+
+const GRState *GRState::bindDefault(SVal loc, SVal V) const {
+  GRStateManager &Mgr = getStateManager();
+  const MemRegion *R = cast<loc::MemRegionVal>(loc).getRegion();
+  Store new_store = Mgr.StoreMgr->BindDefault(St, R, V);
+  const GRState *new_state = makeWithStore(new_store);
+  return Mgr.getOwningEngine().ProcessRegionChange(new_state, R);
+}
+
+const GRState *GRState::InvalidateRegions(const MemRegion * const *Begin,
+                                          const MemRegion * const *End,
+                                          const Expr *E, unsigned Count,
+                                          StoreManager::InvalidatedSymbols *IS,
+                                          bool invalidateGlobals) const {
+  GRStateManager &Mgr = getStateManager();
+  GRSubEngine &Eng = Mgr.getOwningEngine();
+
+  if (Eng.WantsRegionChangeUpdate(this)) {
+    StoreManager::InvalidatedRegions Regions;
+
+    Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
+                                                      E, Count, IS,
+                                                      invalidateGlobals,
+                                                      &Regions);
+    const GRState *new_state = makeWithStore(new_store);
+
+    return Eng.ProcessRegionChanges(new_state,
+                                    &Regions.front(),
+                                    &Regions.back()+1);
+  }
+
+  Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
+                                                    E, Count, IS,
+                                                    invalidateGlobals,
+                                                    NULL);
+  return makeWithStore(new_store);
+}
+
 const GRState *GRState::unbindLoc(Loc LV) const {
   assert(!isa<loc::MemRegionVal>(LV) && "Use InvalidateRegion instead.");
 
@@ -80,6 +148,11 @@
   return makeWithStore(NewStore);
 }
 
+const GRState *GRState::EnterStackFrame(const StackFrameContext *frame) const {
+  Store new_store = getStateManager().StoreMgr->EnterStackFrame(this, frame);
+  return makeWithStore(new_store);
+}
+
 SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const {
   // We only want to do fetches from regions that we can actually bind
   // values.  For example, SymbolicRegions of type 'id<...>' cannot





More information about the cfe-commits mailing list