Author: Nikita Popov Date: 2023-06-14T09:58:52+02:00 New Revision: 0211a75ed8b80848af7c87d2f925467448ae4f34
URL: https://github.com/llvm/llvm-project/commit/0211a75ed8b80848af7c87d2f925467448ae4f34 DIFF: https://github.com/llvm/llvm-project/commit/0211a75ed8b80848af7c87d2f925467448ae4f34.diff LOG: [Clang] Rename getElementBitCast() -> withElementType() (NFC) This no longer creates a bitcast, just changes the element type of the ConstantAddress. Added: Modified: clang/lib/CodeGen/Address.h clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/CodeGen/CGExprConstant.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/Address.h b/clang/lib/CodeGen/Address.h index e020d95344ade..899aceac88672 100644 --- a/clang/lib/CodeGen/Address.h +++ b/clang/lib/CodeGen/Address.h @@ -127,10 +127,8 @@ class ConstantAddress : public Address { return llvm::cast<llvm::Constant>(Address::getPointer()); } - ConstantAddress getElementBitCast(llvm::Type *ElemTy) const { - llvm::Constant *BitCast = llvm::ConstantExpr::getBitCast( - getPointer(), ElemTy->getPointerTo(getAddressSpace())); - return ConstantAddress(BitCast, ElemTy, getAlignment()); + ConstantAddress withElementType(llvm::Type *ElemTy) const { + return ConstantAddress(getPointer(), ElemTy, getAlignment()); } static bool isaImpl(Address addr) { diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index bf5013e521097..9c63e154ebebd 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -137,7 +137,7 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D, } // Otherwise, the standard logic requires a helper function. } else { - Addr = Addr.getElementBitCast(CGF.ConvertTypeForMem(Type)); + Addr = Addr.withElementType(CGF.ConvertTypeForMem(Type)); Func = CodeGenFunction(CGM) .generateDestroyHelper(Addr, Type, CGF.getDestroyer(DtorKind), CGF.needsEHCleanup(DtorKind), &D); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b0dd598715840..5bd42d9337506 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1987,7 +1987,7 @@ static ConstantLValue emitConstantObjCStringLiteral(const StringLiteral *S, QualType T, CodeGenModule &CGM) { auto C = CGM.getObjCRuntime().GenerateConstantString(S); - return C.getElementBitCast(CGM.getTypes().ConvertTypeForMem(T)); + return C.withElementType(CGM.getTypes().ConvertTypeForMem(T)); } ConstantLValue _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits