From 4098598ca88c61d8c6123cd0f42e03ba57eb7f9f Mon Sep 17 00:00:00 2001 From: Marcin Swiderski Date: Tue, 16 Nov 2010 07:15:33 +0000 Subject: Basic support for C++ in BasicStore: - CXXThisRegion treated like VarRegion and ObjCIVarRegion in various places, - Reference treated like pointer in BindDeclInternal. llvm-svn: 119333 --- clang/lib/Checker/BasicStore.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'clang/lib/Checker/BasicStore.cpp') diff --git a/clang/lib/Checker/BasicStore.cpp b/clang/lib/Checker/BasicStore.cpp index 5221ae3495f..d3860235ec0 100644 --- a/clang/lib/Checker/BasicStore.cpp +++ b/clang/lib/Checker/BasicStore.cpp @@ -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 @@ SVal BasicStoreManager::Retrieve(Store store, Loc loc, QualType T) { case loc::MemRegionKind: { const MemRegion* R = cast(loc).getRegion(); - if (!(isa(R) || isa(R))) + if (!(isa(R) || isa(R) || + isa(R))) return UnknownVal(); BindingsTy B = GetBindings(store); @@ -231,7 +233,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) { R = ER->getSuperRegion(); } - if (!(isa(R) || isa(R))) + if (!(isa(R) || isa(R) || isa(R))) return store; const TypedRegion *TyR = cast(R); @@ -263,7 +265,8 @@ Store BasicStoreManager::Remove(Store store, Loc loc) { case loc::MemRegionKind: { const MemRegion* R = cast(loc).getRegion(); - if (!(isa(R) || isa(R))) + if (!(isa(R) || isa(R) || + isa(R))) return store; return VBFactory.Remove(GetBindings(store), R).getRoot(); @@ -291,7 +294,8 @@ Store BasicStoreManager::RemoveDeadBindings(Store store, continue; } else if (isa(I.getKey()) || - isa(I.getKey())) + isa(I.getKey()) || + isa(I.getKey())) RegionRoots.push_back(I.getKey()); else continue; @@ -315,7 +319,7 @@ Store BasicStoreManager::RemoveDeadBindings(Store store, break; } else if (isa(MR) || isa(MR) || - isa(MR)) { + isa(MR) || isa(MR)) { if (Marked.count(MR)) break; @@ -463,7 +467,8 @@ Store BasicStoreManager::BindDeclInternal(Store store, const VarRegion* VR, // 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); } -- cgit v1.2.3