Author: kjdyck
Date: Tue Jan 25 20:17:08 2011
New Revision: 124274

URL: http://llvm.org/viewvc/llvm-project?rev=124274&view=rev
Log:
Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
converting getBaseClassOffsetInBits() to CharUnits.

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

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=124274&r1=124273&r2=124274&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Jan 25 20:17:08 2011
@@ -549,7 +549,7 @@
 
     // Now figure out the necessary offset to add to the baseLV to get from
     // the derived class to the base class.
-    uint64_t Offset = 0;
+    CharUnits Offset = CharUnits::Zero();
 
     QualType Ty = E->getSubExpr()->getType();
     const CXXRecordDecl *DerivedDecl = 
@@ -567,13 +567,12 @@
       const CXXRecordDecl *BaseDecl = Base->getType()->getAsCXXRecordDecl();
       const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(DerivedDecl);
 
-      Offset += Layout.getBaseClassOffsetInBits(BaseDecl);
+      Offset += Layout.getBaseClassOffset(BaseDecl);
       DerivedDecl = BaseDecl;
     }
 
     Result.Base = BaseLV.getLValueBase();
-    Result.Offset = BaseLV.getLValueOffset() + 
-      Info.Ctx.toCharUnitsFromBits(Offset);
+    Result.Offset = BaseLV.getLValueOffset() + Offset;
     return true;
   }
 
@@ -1595,9 +1594,7 @@
         return false;
       
       // Add the offset to the base.
-      Result += Info.Ctx.toCharUnitsFromBits(
-             RL.getBaseClassOffsetInBits(
-               cast<CXXRecordDecl>(BaseRT->getDecl())));
+      Result += RL.getBaseClassOffset(cast<CXXRecordDecl>(BaseRT->getDecl()));
       break;
     }
     }


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to