[cfe-commits] r124093 - in /cfe/trunk: include/clang/StaticAnalyzer/PathSensitive/MemRegion.h lib/StaticAnalyzer/MemRegion.cpp lib/StaticAnalyzer/RegionStore.cpp lib/StaticAnalyzer/SimpleSValBuilder.cpp lib/StaticAnalyzer/Store.cpp
Ken Dyck
kd at kendyck.com
Sun Jan 23 17:55:40 PST 2011
Author: kjdyck
Date: Sun Jan 23 19:55:39 2011
New Revision: 124093
URL: http://llvm.org/viewvc/llvm-project?rev=124093&view=rev
Log:
Use CharUnits for the offset amount of RegionRawOffset.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h
cfe/trunk/lib/StaticAnalyzer/MemRegion.cpp
cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp
cfe/trunk/lib/StaticAnalyzer/SimpleSValBuilder.cpp
cfe/trunk/lib/StaticAnalyzer/Store.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h?rev=124093&r1=124092&r2=124093&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/MemRegion.h Sun Jan 23 19:55:39 2011
@@ -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 @@
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;
Modified: cfe/trunk/lib/StaticAnalyzer/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/MemRegion.cpp?rev=124093&r1=124092&r2=124093&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/MemRegion.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/MemRegion.cpp Sun Jan 23 19:55:39 2011
@@ -469,7 +469,7 @@
}
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 @@
}
assert(superR && "super region cannot be NULL");
- return RegionRawOffset(superR, offset.getQuantity());
+ return RegionRawOffset(superR, offset);
}
RegionOffset MemRegion::getAsOffset() const {
Modified: cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp?rev=124093&r1=124092&r2=124093&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/RegionStore.cpp Sun Jan 23 19:55:39 2011
@@ -86,7 +86,7 @@
// 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);
Modified: cfe/trunk/lib/StaticAnalyzer/SimpleSValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/SimpleSValBuilder.cpp?rev=124093&r1=124092&r2=124093&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/SimpleSValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/SimpleSValBuilder.cpp Sun Jan 23 19:55:39 2011
@@ -724,8 +724,8 @@
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:
Modified: cfe/trunk/lib/StaticAnalyzer/Store.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Store.cpp?rev=124093&r1=124092&r2=124093&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Store.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Store.cpp Sun Jan 23 19:55:39 2011
@@ -147,7 +147,7 @@
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
More information about the cfe-commits
mailing list