зеркало из https://github.com/microsoft/clang-1.git
Identify AnonPointeeRegion by the symbol that is concretized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
3bb662a863
Коммит
c5458622a3
|
@ -237,25 +237,28 @@ public:
|
|||
/// parameters or pointer globals. In RegionStoreManager, we assume pointer
|
||||
/// parameters or globals point at some anonymous region. Such regions are not
|
||||
/// the regions associated with the pointer variables themselves. They are
|
||||
/// identified by the MemRegion of the pointer pointing to them. We create
|
||||
/// them lazily.
|
||||
/// identified by the symbols that are concretized. We create them lazily.
|
||||
|
||||
class AnonPointeeRegion : public TypedRegion {
|
||||
friend class MemRegionManager;
|
||||
// VD - the pointer variable that points at this region.
|
||||
const TypedRegion* Pointer;
|
||||
|
||||
AnonPointeeRegion(const TypedRegion* r, MemRegion* sreg)
|
||||
: TypedRegion(sreg, AnonPointeeRegionKind), Pointer(r) {}
|
||||
// Sym - the symbol that is concretized.
|
||||
SymbolRef Sym;
|
||||
|
||||
// Ty - the type of the region.
|
||||
QualType T;
|
||||
|
||||
AnonPointeeRegion(SymbolRef sym, QualType t, MemRegion* sreg)
|
||||
: TypedRegion(sreg, AnonPointeeRegionKind), Sym(sym), T(t) {}
|
||||
|
||||
public:
|
||||
QualType getType(ASTContext& C) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const TypedRegion* R,
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef Sym,
|
||||
const MemRegion* superRegion);
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const {
|
||||
ProfileRegion(ID, Pointer, superRegion);
|
||||
ProfileRegion(ID, Sym, superRegion);
|
||||
}
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
|
@ -519,7 +522,7 @@ public:
|
|||
|
||||
AnonTypedRegion* getAnonTypedRegion(QualType t, const MemRegion* superRegion);
|
||||
|
||||
AnonPointeeRegion* getAnonPointeeRegion(const TypedRegion* r);
|
||||
AnonPointeeRegion* getAnonPointeeRegion(SymbolRef Sym, QualType T);
|
||||
|
||||
bool hasStackStorage(const MemRegion* R);
|
||||
|
||||
|
|
|
@ -52,18 +52,14 @@ void AnonTypedRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, QualType T,
|
|||
}
|
||||
|
||||
QualType AnonPointeeRegion::getType(ASTContext& C) const {
|
||||
QualType T = C.getCanonicalType(Pointer->getType(C));
|
||||
PointerType* PTy = cast<PointerType>(T.getTypePtr());
|
||||
|
||||
QualType PointeeTy = C.getCanonicalType(PTy->getPointeeType());
|
||||
return PointeeTy;
|
||||
return C.getCanonicalType(T);
|
||||
}
|
||||
|
||||
void AnonPointeeRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
const TypedRegion* R,
|
||||
SymbolRef Sym,
|
||||
const MemRegion* superRegion) {
|
||||
ID.AddInteger((unsigned) AnonPointeeRegionKind);
|
||||
ID.AddPointer(R);
|
||||
Sym.Profile(ID);
|
||||
ID.AddPointer(superRegion);
|
||||
}
|
||||
|
||||
|
@ -394,11 +390,12 @@ MemRegionManager::getAnonTypedRegion(QualType t, const MemRegion* superRegion) {
|
|||
return R;
|
||||
}
|
||||
|
||||
AnonPointeeRegion* MemRegionManager::getAnonPointeeRegion(const TypedRegion* r) {
|
||||
AnonPointeeRegion* MemRegionManager::getAnonPointeeRegion(SymbolRef Sym,
|
||||
QualType T) {
|
||||
llvm::FoldingSetNodeID ID;
|
||||
MemRegion* superRegion = getUnknownRegion();
|
||||
|
||||
AnonPointeeRegion::ProfileRegion(ID, r, superRegion);
|
||||
AnonPointeeRegion::ProfileRegion(ID, Sym, superRegion);
|
||||
|
||||
void* InsertPos;
|
||||
MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
|
||||
|
@ -406,7 +403,7 @@ AnonPointeeRegion* MemRegionManager::getAnonPointeeRegion(const TypedRegion* r)
|
|||
|
||||
if (!R) {
|
||||
R = (AnonPointeeRegion*) A.Allocate<AnonPointeeRegion>();
|
||||
new (R) AnonPointeeRegion(r, superRegion);
|
||||
new (R) AnonPointeeRegion(Sym, T, superRegion);
|
||||
Regions.InsertNode(R, InsertPos);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче