aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicValueFactory.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-29 22:17:41 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-29 22:17:41 +0000
commit718c4f7b3ff713c3ebee46553d687bde63e5666f (patch)
treeaeb2f3877956ce8c59a70d6925b933133655d906 /lib/Analysis/BasicValueFactory.cpp
parent1b8bd4d71c2098126041b4de4267175a82f0103c (diff)
Added lval::FieldOffset, which represents symbolic lvalues for field offsets from other Lvalues.
This removes the failure in null-deref-ps.c (test suite). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicValueFactory.cpp')
-rw-r--r--lib/Analysis/BasicValueFactory.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Analysis/BasicValueFactory.cpp b/lib/Analysis/BasicValueFactory.cpp
index 22fb2d1b6e..b0aa79e067 100644
--- a/lib/Analysis/BasicValueFactory.cpp
+++ b/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();
}