aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/ProgramPoint.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-04-26 15:19:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-04-26 15:19:51 +0000
commit6e5977f0a8a680191fb4b4d8f32bc2c629faf0c2 (patch)
tree1693063602fb55daf485d20bf8e620d9197a1e60 /include/clang/Analysis/ProgramPoint.h
parentdc34300db91139cf25bec65f1a0861a286f97b17 (diff)
Make assertions for all addresses passed to ProgramPoint that they have at least an 8-byte alignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/ProgramPoint.h')
-rw-r--r--include/clang/Analysis/ProgramPoint.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index a046268cfd..5fc1fb651b 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -31,14 +31,18 @@ protected:
uintptr_t Data;
ProgramPoint(const void* Ptr, Kind k) {
+ setRawData(Ptr, k);
+ }
+
+ ProgramPoint() : Data(0) {}
+
+ void setRawData(const void* Ptr, Kind k) {
assert ((reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) & 0x7) == 0
&& "Address must have at least an 8-byte alignment.");
Data = reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) | k;
}
- ProgramPoint() : Data(0) {}
-
public:
unsigned getKind() const { return Data & 0x7; }
void* getRawPtr() const { return reinterpret_cast<void*>(Data & ~0x7); }
@@ -114,10 +118,8 @@ public:
/// This ctor forces the BlockEdge to be constructed using an explicitly
/// allocated pair object that is stored in the CFG. This is usually
/// used to construct edges representing jumps using computed gotos.
- BlockEdge(CFG& cfg, const CFGBlock* B1, const CFGBlock* B2, bool) {
- Data = reinterpret_cast<uintptr_t>(cfg.getBlockEdgeImpl(B1, B2))
- | BlockEdgeAuxKind;
- }
+ BlockEdge(CFG& cfg, const CFGBlock* B1, const CFGBlock* B2, bool)
+ : ProgramPoint(cfg.getBlockEdgeImpl(B1, B2), BlockEdgeAuxKind) {}
CFGBlock* getSrc() const;