]> granicus.if.org Git - clang/commitdiff
Fix 32-bit build bots and remove some casting-away-const warnings.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 7 Nov 2011 07:31:09 +0000 (07:31 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 7 Nov 2011 07:31:09 +0000 (07:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143914 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/APValue.cpp

index 12420fd8091ee289b0731a815110584410966ced..e2f7c6193760188199cc9f7268910ed7fd6fba5c 100644 (file)
@@ -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));
 }