diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-29 22:17:41 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-29 22:17:41 +0000 |
commit | 0d2ccffa83b60d6745d1390127373a394321e28a (patch) | |
tree | 6073c0e9876629c9365cb37a67f2c03b0937a458 /clang/lib/Analysis/BasicValueFactory.cpp | |
parent | 663f5fccd4332b14c853f8b5d7cd16c60623a012 (diff) | |
download | bcm5719-llvm-0d2ccffa83b60d6745d1390127373a394321e28a.tar.gz bcm5719-llvm-0d2ccffa83b60d6745d1390127373a394321e28a.zip |
Added lval::FieldOffset, which represents symbolic lvalues for field offsets from other Lvalues.
This removes the failure in null-deref-ps.c (test suite).
llvm-svn: 50449
Diffstat (limited to 'clang/lib/Analysis/BasicValueFactory.cpp')
-rw-r--r-- | clang/lib/Analysis/BasicValueFactory.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/Analysis/BasicValueFactory.cpp b/clang/lib/Analysis/BasicValueFactory.cpp index 22fb2d1b6e7..b0aa79e0670 100644 --- a/clang/lib/Analysis/BasicValueFactory.cpp +++ b/clang/lib/Analysis/BasicValueFactory.cpp @@ -18,18 +18,18 @@ using namespace clang; -typedef std::pair<RVal, unsigned> SizedRVal; +typedef std::pair<RVal, uintptr_t> RValData; namespace llvm { -template<> struct FoldingSetTrait<SizedRVal> { - static inline void Profile(const SizedRVal& X, llvm::FoldingSetNodeID& ID) { +template<> struct FoldingSetTrait<RValData> { + static inline void Profile(const RValData& X, llvm::FoldingSetNodeID& ID) { X.first.Profile(ID); - ID.AddInteger(X.second); + ID.AddPointer( (void*) X.second); } }; } -typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<SizedRVal> > +typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<RValData> > PersistentRValsTy; BasicValueFactory::~BasicValueFactory() { @@ -184,8 +184,8 @@ BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op, } -const std::pair<RVal, unsigned>& -BasicValueFactory::getPersistentSizedRVal(const RVal& V, unsigned Bits) { +const std::pair<RVal, uintptr_t>& +BasicValueFactory::getPersistentRValWithData(const RVal& V, uintptr_t Data) { // Lazily create the folding set. if (!PersistentRVals) PersistentRVals = new PersistentRValsTy(); @@ -193,18 +193,18 @@ BasicValueFactory::getPersistentSizedRVal(const RVal& V, unsigned Bits) { llvm::FoldingSetNodeID ID; void* InsertPos; V.Profile(ID); - ID.AddInteger(Bits); + ID.AddPointer((void*) Data); PersistentRValsTy& Map = *((PersistentRValsTy*) PersistentRVals); - typedef llvm::FoldingSetNodeWrapper<SizedRVal> FoldNodeTy; + typedef llvm::FoldingSetNodeWrapper<RValData> FoldNodeTy; FoldNodeTy* P = Map.FindNodeOrInsertPos(ID, InsertPos); if (!P) { P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>(); - new (P) FoldNodeTy(std::make_pair(V, Bits)); + new (P) FoldNodeTy(std::make_pair(V, Data)); Map.InsertNode(P, InsertPos); } - return *P; + return P->getValue(); } |