From 38dce9b19c3cc85698fb44ea182f9e7fa0fa4a69 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 7 Nov 2011 07:31:09 +0000 Subject: [PATCH] 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 --- lib/AST/APValue.cpp | 8 ++++++-- 1 file 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::getLValuePath() const { assert(isLValue() && hasLValuePath() && "Invalid accessor"); - LV &LVal = *((LV*)(char*)Data); + const LV &LVal = *((const LV*)(const char*)Data); return ArrayRef(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)); } -- 2.50.1