Author: Arnold Schwaighofer
Date: 2020-06-15T12:23:20-07:00
New Revision: 4a8120ca9fb904b50e6940457e0f891ca1fdb605

URL: 
https://github.com/llvm/llvm-project/commit/4a8120ca9fb904b50e6940457e0f891ca1fdb605
DIFF: 
https://github.com/llvm/llvm-project/commit/4a8120ca9fb904b50e6940457e0f891ca1fdb605.diff

LOG: Fix ConstantAggregateBuilderBase::getRelativeOffset

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

Fallout from D77592.

rdar://64309883

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81857

Added: 
    

Modified: 
    clang/lib/CodeGen/ConstantInitBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/ConstantInitBuilder.cpp 
b/clang/lib/CodeGen/ConstantInitBuilder.cpp
index 326f079e82fa..24e3ca19709c 100644
--- a/clang/lib/CodeGen/ConstantInitBuilder.cpp
+++ b/clang/lib/CodeGen/ConstantInitBuilder.cpp
@@ -129,7 +129,7 @@ llvm::Constant *
 ConstantAggregateBuilderBase::getRelativeOffset(llvm::IntegerType *offsetType,
                                                 llvm::Constant *target) {
   return getRelativeOffsetToPosition(offsetType, target,
-                                     Builder.SelfReferences.size());
+                                     Builder.Buffer.size() - Begin);
 }
 
 llvm::Constant *ConstantAggregateBuilderBase::getRelativeOffsetToPosition(


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to