Add LocationContext* field to VarRegion.  This is needed for interprocedural analysis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79680 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 518978c..13768ec 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -204,7 +204,8 @@
   /// getLValueVar - Returns an SVal that represents the lvalue of a
   ///  variable.  Within RegionStore a variable has an associated
   ///  VarRegion, and the lvalue of the variable is the lvalue of that region.
-  SVal getLValueVar(const GRState *state, const VarDecl* VD);
+  SVal getLValueVar(const GRState *ST, const VarDecl *VD,
+                    const LocationContext *LC);
   
   SVal getLValueIvar(const GRState *state, const ObjCIvarDecl* D, SVal Base);
 
@@ -243,7 +244,7 @@
           if (MD->getSelfDecl() == PD) {
             SelfRegion = MRMgr.getObjCObjectRegion(MD->getClassInterface(),
                                                    MRMgr.getHeapRegion());
-            B = RBFactory.Add(B, MRMgr.getVarRegion(PD),
+            B = RBFactory.Add(B, MRMgr.getVarRegion(PD, InitLoc),
                               ValMgr.makeLoc(SelfRegion));
           }
         }
@@ -280,9 +281,11 @@
   const GRState *BindCompoundLiteral(const GRState *state,
                                  const CompoundLiteralExpr* CL, SVal V);
   
-  const GRState *BindDecl(const GRState *state, const VarDecl* VD, SVal InitVal);
+  const GRState *BindDecl(const GRState *ST, const VarDecl *VD,
+                          const LocationContext *LC, SVal InitVal);
 
-  const GRState *BindDeclWithNoInit(const GRState *state, const VarDecl* VD) {
+  const GRState *BindDeclWithNoInit(const GRState *state, const VarDecl*,
+                                    const LocationContext *) {
     return state;
   }
 
@@ -547,8 +550,9 @@
 /// getLValueVar - Returns an SVal that represents the lvalue of a
 ///  variable.  Within RegionStore a variable has an associated
 ///  VarRegion, and the lvalue of the variable is the lvalue of that region.
-SVal RegionStoreManager::getLValueVar(const GRState *St, const VarDecl* VD) {
-  return loc::MemRegionVal(MRMgr.getVarRegion(VD));
+SVal RegionStoreManager::getLValueVar(const GRState *ST, const VarDecl *VD,
+                                      const LocationContext *LC) {
+  return loc::MemRegionVal(MRMgr.getVarRegion(VD, LC));
 }
 
 /// getLValueCompoundLiteral - Returns an SVal representing the lvalue
@@ -1345,18 +1349,20 @@
   return state->makeWithStore(RBFactory.Add(B, R, V).getRoot());
 }
 
-const GRState *RegionStoreManager::BindDecl(const GRState *state, 
-                                            const VarDecl* VD, SVal InitVal) {
+const GRState *RegionStoreManager::BindDecl(const GRState *ST,
+                                            const VarDecl *VD,
+                                            const LocationContext *LC,
+                                            SVal InitVal) {
 
   QualType T = VD->getType();
-  VarRegion* VR = MRMgr.getVarRegion(VD);
+  VarRegion* VR = MRMgr.getVarRegion(VD, LC);
 
   if (T->isArrayType())
-    return BindArray(state, VR, InitVal);
+    return BindArray(ST, VR, InitVal);
   if (T->isStructureType())
-    return BindStruct(state, VR, InitVal);
+    return BindStruct(ST, VR, InitVal);
 
-  return Bind(state, ValMgr.makeLoc(VR), InitVal);
+  return Bind(ST, ValMgr.makeLoc(VR), InitVal);
 }
 
 // FIXME: this method should be merged into Bind().