[PATCH] D81857: Fix ConstantAggregateBuilderBase::getRelativeOffset

Arnold Schwaighofer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 10:56:01 PDT 2020


aschwaighofer created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
aschwaighofer added a reviewer: rjmccall.

If a record has a mix of relative pointers and other fields they
wouldn't necessarily be the same.

Fallout from D77592 <https://reviews.llvm.org/D77592>.

rdar://64309883


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81857

Files:
  clang/lib/CodeGen/ConstantInitBuilder.cpp


Index: clang/lib/CodeGen/ConstantInitBuilder.cpp
===================================================================
--- clang/lib/CodeGen/ConstantInitBuilder.cpp
+++ clang/lib/CodeGen/ConstantInitBuilder.cpp
@@ -129,7 +129,7 @@
 ConstantAggregateBuilderBase::getRelativeOffset(llvm::IntegerType *offsetType,
                                                 llvm::Constant *target) {
   return getRelativeOffsetToPosition(offsetType, target,
-                                     Builder.SelfReferences.size());
+                                     Builder.Buffer.size() - Begin);
 }
 
 llvm::Constant *ConstantAggregateBuilderBase::getRelativeOffsetToPosition(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81857.270798.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200615/89cfab3d/attachment.bin>


More information about the cfe-commits mailing list