summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorKen Dyck <kd@kendyck.com>2011-01-24 01:55:39 +0000
committerKen Dyck <kd@kendyck.com>2011-01-24 01:55:39 +0000
commitc28614cec4b28fc71fbed181ea8873802e81a549 (patch)
treecae0d6d459507f021cd587d4b2ed90cb37a52831 /clang
parent7c4026bea79d41eb6675e571c3744db40e70339c (diff)
downloadbcm5719-llvm-c28614cec4b28fc71fbed181ea8873802e81a549.tar.gz
bcm5719-llvm-c28614cec4b28fc71fbed181ea8873802e81a549.zip
Use CharUnits for the offset amount of RegionRawOffset.
llvm-svn: 124093
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h7
-rw-r--r--clang/lib/StaticAnalyzer/MemRegion.cpp4
-rw-r--r--clang/lib/StaticAnalyzer/RegionStore.cpp2
-rw-r--r--clang/lib/StaticAnalyzer/SimpleSValBuilder.cpp4
-rw-r--r--clang/lib/StaticAnalyzer/Store.cpp2
5 files changed, 10 insertions, 9 deletions
diff --git a/clang/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h b/clang/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h
index 6e5790456c1..e18e681e775 100644
--- a/clang/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h
+++ b/clang/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h
@@ -16,6 +16,7 @@
#ifndef LLVM_CLANG_GR_MEMREGION_H
#define LLVM_CLANG_GR_MEMREGION_H
+#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/StaticAnalyzer/PathSensitive/SVals.h"
@@ -778,14 +779,14 @@ private:
friend class ElementRegion;
const MemRegion *Region;
- int64_t Offset;
+ CharUnits Offset;
- RegionRawOffset(const MemRegion* reg, int64_t offset = 0)
+ RegionRawOffset(const MemRegion* reg, CharUnits offset = CharUnits::Zero())
: Region(reg), Offset(offset) {}
public:
// FIXME: Eventually support symbolic offsets.
- int64_t getByteOffset() const { return Offset; }
+ CharUnits getOffset() const { return Offset; }
const MemRegion *getRegion() const { return Region; }
void dumpToStream(llvm::raw_ostream& os) const;
diff --git a/clang/lib/StaticAnalyzer/MemRegion.cpp b/clang/lib/StaticAnalyzer/MemRegion.cpp
index d3d72b51a73..eca7619d3fc 100644
--- a/clang/lib/StaticAnalyzer/MemRegion.cpp
+++ b/clang/lib/StaticAnalyzer/MemRegion.cpp
@@ -469,7 +469,7 @@ void RegionRawOffset::dump() const {
}
void RegionRawOffset::dumpToStream(llvm::raw_ostream& os) const {
- os << "raw_offset{" << getRegion() << ',' << getByteOffset() << '}';
+ os << "raw_offset{" << getRegion() << ',' << getOffset().getQuantity() << '}';
}
void StaticGlobalSpaceRegion::dumpToStream(llvm::raw_ostream &os) const {
@@ -855,7 +855,7 @@ RegionRawOffset ElementRegion::getAsArrayOffset() const {
}
assert(superR && "super region cannot be NULL");
- return RegionRawOffset(superR, offset.getQuantity());
+ return RegionRawOffset(superR, offset);
}
RegionOffset MemRegion::getAsOffset() const {
diff --git a/clang/lib/StaticAnalyzer/RegionStore.cpp b/clang/lib/StaticAnalyzer/RegionStore.cpp
index 3c048064f6e..986278e6284 100644
--- a/clang/lib/StaticAnalyzer/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/RegionStore.cpp
@@ -86,7 +86,7 @@ BindingKey BindingKey::Make(const MemRegion *R, Kind k) {
// FIXME: There are some ElementRegions for which we cannot compute
// raw offsets yet, including regions with symbolic offsets. These will be
// ignored by the store.
- return BindingKey(O.getRegion(), O.getByteOffset(), k);
+ return BindingKey(O.getRegion(), O.getOffset().getQuantity(), k);
}
return BindingKey(R, 0, k);
diff --git a/clang/lib/StaticAnalyzer/SimpleSValBuilder.cpp b/clang/lib/StaticAnalyzer/SimpleSValBuilder.cpp
index a6432121f54..6c65da4635b 100644
--- a/clang/lib/StaticAnalyzer/SimpleSValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/SimpleSValBuilder.cpp
@@ -724,8 +724,8 @@ SVal SimpleSValBuilder::evalBinOpLL(const GRState *state,
if (LeftOffset.getRegion() != NULL &&
LeftOffset.getRegion() == RightOffset.getRegion()) {
- int64_t left = LeftOffset.getByteOffset();
- int64_t right = RightOffset.getByteOffset();
+ CharUnits left = LeftOffset.getOffset();
+ CharUnits right = RightOffset.getOffset();
switch (op) {
default:
diff --git a/clang/lib/StaticAnalyzer/Store.cpp b/clang/lib/StaticAnalyzer/Store.cpp
index d162eed2477..fa671a3bb0e 100644
--- a/clang/lib/StaticAnalyzer/Store.cpp
+++ b/clang/lib/StaticAnalyzer/Store.cpp
@@ -147,7 +147,7 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
if (!baseR)
return NULL;
- CharUnits off = CharUnits::fromQuantity(rawOff.getByteOffset());
+ CharUnits off = rawOff.getOffset();
if (off.isZero()) {
// Edge case: we are at 0 bytes off the beginning of baseR. We
OpenPOWER on IntegriCloud