From: Marcin Swiderski Date: Tue, 16 Nov 2010 07:15:33 +0000 (+0000) Subject: Basic support for C++ in BasicStore: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11b39d48702e3f494c71eed0ede0c3d27c54160e;p=clang Basic support for C++ in BasicStore: - CXXThisRegion treated like VarRegion and ObjCIVarRegion in various places, - Reference treated like pointer in BindDeclInternal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119333 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Checker/BasicStore.cpp b/lib/Checker/BasicStore.cpp index 5221ae3495..d3860235ec 100644 --- a/lib/Checker/BasicStore.cpp +++ b/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); }