[cfe-commits] r119333 - /cfe/trunk/lib/Checker/BasicStore.cpp
Marcin Swiderski
marcin.sfider at gmail.com
Mon Nov 15 23:15:34 PST 2010
Author: sfider
Date: Tue Nov 16 01:15:33 2010
New Revision: 119333
URL: http://llvm.org/viewvc/llvm-project?rev=119333&view=rev
Log:
Basic support for C++ in BasicStore:
- CXXThisRegion treated like VarRegion and ObjCIVarRegion in various places,
- Reference treated like pointer in BindDeclInternal.
Modified:
cfe/trunk/lib/Checker/BasicStore.cpp
Modified: cfe/trunk/lib/Checker/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicStore.cpp?rev=119333&r1=119332&r2=119333&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BasicStore.cpp (original)
+++ cfe/trunk/lib/Checker/BasicStore.cpp Tue Nov 16 01:15:33 2010
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/DeclCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/Analysis/AnalysisContext.h"
@@ -179,7 +180,8 @@
case loc::MemRegionKind: {
const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
- if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
+ if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R) ||
+ isa<CXXThisRegion>(R)))
return UnknownVal();
BindingsTy B = GetBindings(store);
@@ -231,7 +233,7 @@
R = ER->getSuperRegion();
}
- if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
+ if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R) || isa<CXXThisRegion>(R)))
return store;
const TypedRegion *TyR = cast<TypedRegion>(R);
@@ -263,7 +265,8 @@
case loc::MemRegionKind: {
const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
- if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R)))
+ if (!(isa<VarRegion>(R) || isa<ObjCIvarRegion>(R) ||
+ isa<CXXThisRegion>(R)))
return store;
return VBFactory.Remove(GetBindings(store), R).getRoot();
@@ -291,7 +294,8 @@
continue;
}
else if (isa<ObjCIvarRegion>(I.getKey()) ||
- isa<NonStaticGlobalSpaceRegion>(I.getKey()))
+ isa<NonStaticGlobalSpaceRegion>(I.getKey()) ||
+ isa<CXXThisRegion>(I.getKey()))
RegionRoots.push_back(I.getKey());
else
continue;
@@ -315,7 +319,7 @@
break;
}
else if (isa<VarRegion>(MR) || isa<ObjCIvarRegion>(MR) ||
- isa<NonStaticGlobalSpaceRegion>(MR)) {
+ isa<NonStaticGlobalSpaceRegion>(MR) || isa<CXXThisRegion>(MR)) {
if (Marked.count(MR))
break;
@@ -463,7 +467,8 @@
// Process local scalar variables.
QualType T = VD->getType();
// BasicStore only supports scalars.
- if (T->isScalarType() && ValMgr.getSymbolManager().canSymbolicate(T)) {
+ if ((T->isScalarType() || T->isReferenceType()) &&
+ ValMgr.getSymbolManager().canSymbolicate(T)) {
SVal V = InitVal ? *InitVal : UndefinedVal();
store = Bind(store, loc::MemRegionVal(VR), V);
}
More information about the cfe-commits
mailing list