class Loc : public SVal {
protected:
Loc(unsigned SubKind, const void* D)
- : SVal(const_cast<void*>(D), true, SubKind) {}
+ : SVal(const_cast<void*>(D), true, SubKind) {}
- // Equality operators.
- NonLoc EQ(SymbolManager& SM, const Loc& R) const;
- NonLoc NE(SymbolManager& SM, const Loc& R) const;
+// // Equality operators.
+// NonLoc EQ(SymbolManager& SM, Loc R) const;
+// NonLoc NE(SymbolManager& SM, Loc R) const;
public:
void print(llvm::raw_ostream& Out) const;
+ Loc(const Loc& X) : SVal(X.Data, true, X.getSubKind()) {}
+ Loc& operator=(const Loc& X) { memcpy(this, &X, sizeof(Loc)); return *this; }
+
static Loc MakeVal(const MemRegion* R);
static Loc MakeVal(AddrLabelExpr* E);
return UndefinedVal();
}
-NonLoc Loc::EQ(SymbolManager& SymMgr, const Loc& R) const {
-
- switch (getSubKind()) {
- default:
- assert(false && "EQ not implemented for this Loc.");
- break;
-
- case loc::ConcreteIntKind:
- if (isa<loc::ConcreteInt>(R)) {
- bool b = cast<loc::ConcreteInt>(this)->getValue() ==
- cast<loc::ConcreteInt>(R).getValue();
-
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), b);
- }
- else if (isa<loc::SymbolVal>(R)) {
- const SymIntExpr *SE =
- SymMgr.getSymIntExpr(cast<loc::SymbolVal>(R).getSymbol(),
- BinaryOperator::EQ,
- cast<loc::ConcreteInt>(this)->getValue(),
- SymMgr.getContext().IntTy);
-
- return nonloc::SymExprVal(SE);
- }
-
- break;
-
- case loc::SymbolValKind: {
- if (isa<loc::ConcreteInt>(R)) {
- const SymIntExpr *SE =
- SymMgr.getSymIntExpr(cast<loc::SymbolVal>(this)->getSymbol(),
- BinaryOperator::EQ,
- cast<loc::ConcreteInt>(R).getValue(),
- SymMgr.getContext().IntTy);
-
- return nonloc::SymExprVal(SE);
- }
-
- assert (!isa<loc::SymbolVal>(R) && "FIXME: Implement unification.");
- break;
- }
-
- case loc::MemRegionKind:
- if (isa<loc::MemRegionVal>(R)) {
- bool b = cast<loc::MemRegionVal>(*this) == cast<loc::MemRegionVal>(R);
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), b);
- }
-
- break;
- }
-
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), false);
-}
-
-NonLoc Loc::NE(SymbolManager& SymMgr, const Loc& R) const {
- switch (getSubKind()) {
- default:
- assert(false && "NE not implemented for this Loc.");
- break;
-
- case loc::ConcreteIntKind:
- if (isa<loc::ConcreteInt>(R)) {
- bool b = cast<loc::ConcreteInt>(this)->getValue() !=
- cast<loc::ConcreteInt>(R).getValue();
-
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), b);
- }
- else if (isa<loc::SymbolVal>(R)) {
- const SymIntExpr *SE =
- SymMgr.getSymIntExpr(cast<loc::SymbolVal>(R).getSymbol(),
- BinaryOperator::NE,
- cast<loc::ConcreteInt>(this)->getValue(),
- SymMgr.getContext().IntTy);
- return nonloc::SymExprVal(SE);
- }
- break;
-
- case loc::SymbolValKind: {
- if (isa<loc::ConcreteInt>(R)) {
- const SymIntExpr *SE =
- SymMgr.getSymIntExpr(cast<loc::SymbolVal>(this)->getSymbol(),
- BinaryOperator::NE,
- cast<loc::ConcreteInt>(R).getValue(),
- SymMgr.getContext().IntTy);
-
- return nonloc::SymExprVal(SE);
- }
-
- assert (!isa<loc::SymbolVal>(R) && "FIXME: Implement sym !=.");
- break;
- }
-
- case loc::MemRegionKind:
- if (isa<loc::MemRegionVal>(R)) {
- bool b = cast<loc::MemRegionVal>(*this)==cast<loc::MemRegionVal>(R);
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), b);
- }
-
- break;
- }
-
- return NonLoc::MakeIntTruthVal(SymMgr.getBasicVals(), true);
-}
-
//===----------------------------------------------------------------------===//
// Utility methods for constructing Non-Locs.
//===----------------------------------------------------------------------===//