From 751fe286dc39227a01ecd8e6a92a4b0392fc0eb6 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Sat, 9 Feb 2019 22:22:28 +0000 Subject: [opaque pointer types] Cleanup CGBuilder's Create*GEP. The various EltSize, Offset, DataLayout, and StructLayout arguments are all computable from the Address's element type and the DataLayout which the CGBuilder already has access to. After having previously asserted that the computed values are the same as those passed in, now remove the redundant arguments from CGBuilder's Create*GEP functions. Differential Revision: https://reviews.llvm.org/D57767 llvm-svn: 353629 --- clang/lib/CodeGen/CGExprComplex.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CGExprComplex.cpp') diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 343b8eea2acc..2e69d925fb4d 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -327,15 +327,12 @@ public: Address CodeGenFunction::emitAddrOfRealComponent(Address addr, QualType complexType) { - CharUnits offset = CharUnits::Zero(); - return Builder.CreateStructGEP(addr, 0, offset, addr.getName() + ".realp"); + return Builder.CreateStructGEP(addr, 0, addr.getName() + ".realp"); } Address CodeGenFunction::emitAddrOfImagComponent(Address addr, QualType complexType) { - QualType eltType = complexType->castAs()->getElementType(); - CharUnits offset = getContext().getTypeSizeInChars(eltType); - return Builder.CreateStructGEP(addr, 1, offset, addr.getName() + ".imagp"); + return Builder.CreateStructGEP(addr, 1, addr.getName() + ".imagp"); } /// EmitLoadOfLValue - Given an RValue reference for a complex, emit code to -- cgit v1.2.3