Introduce 'DefinedSVal', an intermediate parent class between Loc/NonLoc and
SVal. This allows us to use the C++ type system to distinguish between SVals that are potentially unknown/undefined and those that are not. llvm-svn: 79951
This commit is contained in:
parent
f5147c6c02
commit
d64be8201d
|
@ -172,10 +172,21 @@ public:
|
|||
|
||||
void* getData() const { return Data; }
|
||||
};
|
||||
|
||||
class NonLoc : public SVal {
|
||||
|
||||
class DefinedSVal : public SVal {
|
||||
protected:
|
||||
NonLoc(unsigned SubKind, const void* d) : SVal(d, false, SubKind) {}
|
||||
DefinedSVal(const void* d, bool isLoc, unsigned ValKind)
|
||||
: SVal(d, isLoc, ValKind) {}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SVal *V) {
|
||||
return !V->isUnknownOrUndef();
|
||||
}
|
||||
};
|
||||
|
||||
class NonLoc : public DefinedSVal {
|
||||
protected:
|
||||
NonLoc(unsigned SubKind, const void* d) : DefinedSVal(d, false, SubKind) {}
|
||||
|
||||
public:
|
||||
void dumpToStream(llvm::raw_ostream& Out) const;
|
||||
|
@ -186,15 +197,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class Loc : public SVal {
|
||||
class Loc : public DefinedSVal {
|
||||
protected:
|
||||
Loc(unsigned SubKind, const void* D)
|
||||
: SVal(const_cast<void*>(D), true, SubKind) {}
|
||||
: DefinedSVal(const_cast<void*>(D), true, SubKind) {}
|
||||
|
||||
public:
|
||||
void dumpToStream(llvm::raw_ostream& Out) const;
|
||||
|
||||
Loc(const Loc& X) : SVal(X.Data, true, X.getSubKind()) {}
|
||||
Loc(const Loc& X) : DefinedSVal(X.Data, true, X.getSubKind()) {}
|
||||
Loc& operator=(const Loc& X) { memcpy(this, &X, sizeof(Loc)); return *this; }
|
||||
|
||||
// Implement isa<T> support.
|
||||
|
|
Loading…
Reference in New Issue