Skip to content

Commit 27b297b

Browse files
committed
[clang] Fix -Wunused-variable in CGCall.cpp (NFC)
llvm-project/clang/lib/CodeGen/CGCall.cpp:3226:24: error: unused variable 'StructSize' [-Werror,-Wunused-variable] llvm::TypeSize StructSize = CGM.getDataLayout().getTypeAllocSize(STy); ^ llvm-project/clang/lib/CodeGen/CGCall.cpp:3227:24: error: unused variable 'PtrElementSize' [-Werror,-Wunused-variable] llvm::TypeSize PtrElementSize = ^ llvm-project/clang/lib/CodeGen/CGCall.cpp:5313:24: error: unused variable 'SrcTypeSize' [-Werror,-Wunused-variable] llvm::TypeSize SrcTypeSize = ^ llvm-project/clang/lib/CodeGen/CGCall.cpp:5315:24: error: unused variable 'DstTypeSize' [-Werror,-Wunused-variable] llvm::TypeSize DstTypeSize = CGM.getDataLayout().getTypeAllocSize(STy); ^ 4 errors generated.
1 parent 07d8a45 commit 27b297b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,8 +3223,9 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
32233223
dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
32243224
if (ArgI.isDirect() && !ArgI.getCanBeFlattened() && STy &&
32253225
STy->getNumElements() > 1) {
3226-
llvm::TypeSize StructSize = CGM.getDataLayout().getTypeAllocSize(STy);
3227-
llvm::TypeSize PtrElementSize =
3226+
[[maybe_unused]] llvm::TypeSize StructSize =
3227+
CGM.getDataLayout().getTypeAllocSize(STy);
3228+
[[maybe_unused]] llvm::TypeSize PtrElementSize =
32283229
CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(Ty));
32293230
if (STy->containsHomogeneousScalableVectorTypes()) {
32303231
assert(StructSize == PtrElementSize &&
@@ -5310,9 +5311,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
53105311
dyn_cast<llvm::StructType>(ArgInfo.getCoerceToType());
53115312
if (STy && ArgInfo.isDirect() && !ArgInfo.getCanBeFlattened()) {
53125313
llvm::Type *SrcTy = ConvertTypeForMem(I->Ty);
5313-
llvm::TypeSize SrcTypeSize =
5314+
[[maybe_unused]] llvm::TypeSize SrcTypeSize =
53145315
CGM.getDataLayout().getTypeAllocSize(SrcTy);
5315-
llvm::TypeSize DstTypeSize = CGM.getDataLayout().getTypeAllocSize(STy);
5316+
[[maybe_unused]] llvm::TypeSize DstTypeSize =
5317+
CGM.getDataLayout().getTypeAllocSize(STy);
53165318
if (STy->containsHomogeneousScalableVectorTypes()) {
53175319
assert(SrcTypeSize == DstTypeSize &&
53185320
"Only allow non-fractional movement of structure with "

0 commit comments

Comments
 (0)