This revision was automatically updated to reflect the committed changes.
Closed by commit rL249085: Don't adjust field offsets when using external 
record layout. (authored by zturner).

Changed prior to commit:
  http://reviews.llvm.org/D13276?vs=36054&id=36310#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13276

Files:
  cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Index: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
@@ -2667,13 +2667,20 @@
   // alignment.
   CharUnits Offset = PointerInfo.Size.RoundUpToAlignment(
       std::max(RequiredAlignment, Alignment));
-  // Increase the size of the object and push back all fields, the vbptr and 
all
-  // bases by the offset amount.
+  // Push back the vbptr, but increase the size of the object and push back
+  // regular fields by the offset only if not using external record layout.
+  if (HasVBPtr)
+    VBPtrOffset += Offset;
+
+  if (UseExternalLayout)
+    return;
+
   Size += Offset;
+
+  // If we're using an external layout, the fields offsets have already
+  // accounted for this adjustment.
   for (uint64_t &FieldOffset : FieldOffsets)
     FieldOffset += Context.toBits(Offset);
-  if (HasVBPtr)
-    VBPtrOffset += Offset;
   for (BaseOffsetsMapTy::value_type &Base : Bases)
     Base.second += Offset;
 }


Index: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
@@ -2667,13 +2667,20 @@
   // alignment.
   CharUnits Offset = PointerInfo.Size.RoundUpToAlignment(
       std::max(RequiredAlignment, Alignment));
-  // Increase the size of the object and push back all fields, the vbptr and all
-  // bases by the offset amount.
+  // Push back the vbptr, but increase the size of the object and push back
+  // regular fields by the offset only if not using external record layout.
+  if (HasVBPtr)
+    VBPtrOffset += Offset;
+
+  if (UseExternalLayout)
+    return;
+
   Size += Offset;
+
+  // If we're using an external layout, the fields offsets have already
+  // accounted for this adjustment.
   for (uint64_t &FieldOffset : FieldOffsets)
     FieldOffset += Context.toBits(Offset);
-  if (HasVBPtr)
-    VBPtrOffset += Offset;
   for (BaseOffsetsMapTy::value_type &Base : Bases)
     Base.second += Offset;
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to