aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/APValue.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-07 07:31:09 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-07 07:31:09 +0000
commit38dce9b19c3cc85698fb44ea182f9e7fa0fa4a69 (patch)
tree6146d16a71124179a65a617ec1dca29e4f7bf73e /lib/AST/APValue.cpp
parent19ff92b4c285a01763999bcbd343746fcb40dbc4 (diff)
Fix 32-bit build bots and remove some casting-away-const warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r--lib/AST/APValue.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp
index 12420fd809..e2f7c61937 100644
--- a/lib/AST/APValue.cpp
+++ b/lib/AST/APValue.cpp
@@ -50,6 +50,9 @@ struct APValue::LV : LVBase {
bool hasPathPtr() const { return hasPath() && PathLength > InlinePathSpace; }
LValuePathEntry *getPath() { return hasPathPtr() ? PathPtr : Path; }
+ const LValuePathEntry *getPath() const {
+ return hasPathPtr() ? PathPtr : Path;
+ }
};
APValue::APValue(const Expr* B) : Kind(Uninitialized) {
@@ -207,12 +210,12 @@ CharUnits &APValue::getLValueOffset() {
bool APValue::hasLValuePath() const {
assert(isLValue() && "Invalid accessor");
- return ((LV*)(char*)Data)->hasPath();
+ return ((const LV*)(const char*)Data)->hasPath();
}
ArrayRef<APValue::LValuePathEntry> APValue::getLValuePath() const {
assert(isLValue() && hasLValuePath() && "Invalid accessor");
- LV &LVal = *((LV*)(char*)Data);
+ const LV &LVal = *((const LV*)(const char*)Data);
return ArrayRef<LValuePathEntry>(LVal.getPath(), LVal.PathLength);
}
@@ -231,6 +234,7 @@ void APValue::setLValue(const Expr *B, const CharUnits &O,
LVal.Base = B;
LVal.Offset = O;
LVal.PathLength = Path.size();
+ LVal.allocPath();
memcpy(LVal.getPath(), Path.data(), Path.size() * sizeof(LValuePathEntry));
}