[cfe-commits] r143914 - /cfe/trunk/lib/AST/APValue.cpp

Richard Smith richard-llvm at metafoo.co.uk
Sun Nov 6 23:31:09 PST 2011


Author: rsmith
Date: Mon Nov  7 01:31:09 2011
New Revision: 143914

URL: http://llvm.org/viewvc/llvm-project?rev=143914&view=rev
Log:
Fix 32-bit build bots and remove some casting-away-const warnings.

Modified:
    cfe/trunk/lib/AST/APValue.cpp

Modified: cfe/trunk/lib/AST/APValue.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=143914&r1=143913&r2=143914&view=diff
==============================================================================
--- cfe/trunk/lib/AST/APValue.cpp (original)
+++ cfe/trunk/lib/AST/APValue.cpp Mon Nov  7 01:31:09 2011
@@ -50,6 +50,9 @@
   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 @@
 
 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 @@
   LVal.Base = B;
   LVal.Offset = O;
   LVal.PathLength = Path.size();
+  LVal.allocPath();
   memcpy(LVal.getPath(), Path.data(), Path.size() * sizeof(LValuePathEntry));
 }
 





More information about the cfe-commits mailing list