Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit b0c092f

Browse files
Suppress all uses of LLVM_END_WITH_NULL. NFC.
Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential revision: https://reviews.llvm.org/D32550 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302572 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 56d4ee6 commit b0c092f

18 files changed

+204
-298
lines changed

lib/CodeGen/CGBlocks.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,8 @@ llvm::Type *CodeGenModule::getBlockDescriptorType() {
961961
// const char *signature; // the block signature
962962
// const char *layout; // reserved
963963
// };
964-
BlockDescriptorType =
965-
llvm::StructType::create("struct.__block_descriptor",
966-
UnsignedLongTy, UnsignedLongTy, nullptr);
964+
BlockDescriptorType = llvm::StructType::create(
965+
"struct.__block_descriptor", UnsignedLongTy, UnsignedLongTy);
967966

968967
// Now form a pointer to that.
969968
unsigned AddrSpace = 0;
@@ -987,9 +986,8 @@ llvm::Type *CodeGenModule::getGenericBlockLiteralType() {
987986
// struct __block_descriptor *__descriptor;
988987
// };
989988
GenericBlockLiteralType =
990-
llvm::StructType::create("struct.__block_literal_generic",
991-
VoidPtrTy, IntTy, IntTy, VoidPtrTy,
992-
BlockDescPtrTy, nullptr);
989+
llvm::StructType::create("struct.__block_literal_generic", VoidPtrTy,
990+
IntTy, IntTy, VoidPtrTy, BlockDescPtrTy);
993991

994992
return GenericBlockLiteralType;
995993
}

lib/CodeGen/CGBuiltin.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -4571,7 +4571,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
45714571
Function *F = CGM.getIntrinsic(BuiltinID == ARM::BI__builtin_arm_stlex
45724572
? Intrinsic::arm_stlexd
45734573
: Intrinsic::arm_strexd);
4574-
llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty, nullptr);
4574+
llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty);
45754575

45764576
Address Tmp = CreateMemTemp(E->getArg(0)->getType());
45774577
Value *Val = EmitScalarExpr(E->getArg(0));
@@ -5401,7 +5401,7 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
54015401
Function *F = CGM.getIntrinsic(BuiltinID == AArch64::BI__builtin_arm_stlex
54025402
? Intrinsic::aarch64_stlxp
54035403
: Intrinsic::aarch64_stxp);
5404-
llvm::Type *STy = llvm::StructType::get(Int64Ty, Int64Ty, nullptr);
5404+
llvm::Type *STy = llvm::StructType::get(Int64Ty, Int64Ty);
54055405

54065406
Address Tmp = CreateMemTemp(E->getArg(0)->getType());
54075407
EmitAnyExprToMem(E->getArg(0), Tmp, Qualifiers(), /*init*/ true);
@@ -7373,8 +7373,8 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
73737373
// unsigned int __cpu_type;
73747374
// unsigned int __cpu_subtype;
73757375
// unsigned int __cpu_features[1];
7376-
llvm::Type *STy = llvm::StructType::get(
7377-
Int32Ty, Int32Ty, Int32Ty, llvm::ArrayType::get(Int32Ty, 1), nullptr);
7376+
llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty, Int32Ty,
7377+
llvm::ArrayType::get(Int32Ty, 1));
73787378

73797379
// Grab the global __cpu_model.
73807380
llvm::Constant *CpuModel = CGM.CreateRuntimeVariable(STy, "__cpu_model");

lib/CodeGen/CGCUDANV.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
265265
"__cudaRegisterFatBinary");
266266
// struct { int magic, int version, void * gpu_binary, void * dont_care };
267267
llvm::StructType *FatbinWrapperTy =
268-
llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy, nullptr);
268+
llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy);
269269

270270
llvm::Function *ModuleCtorFunc = llvm::Function::Create(
271271
llvm::FunctionType::get(VoidTy, VoidPtrTy, false),

lib/CodeGen/CGCleanup.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ DominatingValue<RValue>::saved_type::save(CodeGenFunction &CGF, RValue rv) {
5151
if (rv.isComplex()) {
5252
CodeGenFunction::ComplexPairTy V = rv.getComplexVal();
5353
llvm::Type *ComplexTy =
54-
llvm::StructType::get(V.first->getType(), V.second->getType(),
55-
(void*) nullptr);
54+
llvm::StructType::get(V.first->getType(), V.second->getType());
5655
Address addr = CGF.CreateDefaultAlignTempAlloca(ComplexTy, "saved-complex");
5756
CGF.Builder.CreateStore(V.first,
5857
CGF.Builder.CreateStructGEP(addr, 0, CharUnits()));

lib/CodeGen/CGException.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
765765
llvm::BasicBlock *lpad = createBasicBlock("lpad");
766766
EmitBlock(lpad);
767767

768-
llvm::LandingPadInst *LPadInst = Builder.CreateLandingPad(
769-
llvm::StructType::get(Int8PtrTy, Int32Ty, nullptr), 0);
768+
llvm::LandingPadInst *LPadInst =
769+
Builder.CreateLandingPad(llvm::StructType::get(Int8PtrTy, Int32Ty), 0);
770770

771771
llvm::Value *LPadExn = Builder.CreateExtractValue(LPadInst, 0);
772772
Builder.CreateStore(LPadExn, getExceptionSlot());
@@ -1310,8 +1310,8 @@ llvm::BasicBlock *CodeGenFunction::getTerminateLandingPad() {
13101310
if (!CurFn->hasPersonalityFn())
13111311
CurFn->setPersonalityFn(getOpaquePersonalityFn(CGM, Personality));
13121312

1313-
llvm::LandingPadInst *LPadInst = Builder.CreateLandingPad(
1314-
llvm::StructType::get(Int8PtrTy, Int32Ty, nullptr), 0);
1313+
llvm::LandingPadInst *LPadInst =
1314+
Builder.CreateLandingPad(llvm::StructType::get(Int8PtrTy, Int32Ty), 0);
13151315
LPadInst->addClause(getCatchAllValue(*this));
13161316

13171317
llvm::Value *Exn = nullptr;
@@ -1387,8 +1387,7 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock(bool isCleanup) {
13871387
llvm::Value *Exn = getExceptionFromSlot();
13881388
llvm::Value *Sel = getSelectorFromSlot();
13891389

1390-
llvm::Type *LPadType = llvm::StructType::get(Exn->getType(),
1391-
Sel->getType(), nullptr);
1390+
llvm::Type *LPadType = llvm::StructType::get(Exn->getType(), Sel->getType());
13921391
llvm::Value *LPadVal = llvm::UndefValue::get(LPadType);
13931392
LPadVal = Builder.CreateInsertValue(LPadVal, Exn, 0, "lpad.val");
13941393
LPadVal = Builder.CreateInsertValue(LPadVal, Sel, 1, "lpad.val");
@@ -1747,7 +1746,7 @@ void CodeGenFunction::EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF,
17471746
// };
17481747
// int exceptioncode = exception_pointers->ExceptionRecord->ExceptionCode;
17491748
llvm::Type *RecordTy = CGM.Int32Ty->getPointerTo();
1750-
llvm::Type *PtrsTy = llvm::StructType::get(RecordTy, CGM.VoidPtrTy, nullptr);
1749+
llvm::Type *PtrsTy = llvm::StructType::get(RecordTy, CGM.VoidPtrTy);
17511750
llvm::Value *Ptrs = Builder.CreateBitCast(SEHInfo, PtrsTy->getPointerTo());
17521751
llvm::Value *Rec = Builder.CreateStructGEP(PtrsTy, Ptrs, 0);
17531752
Rec = Builder.CreateAlignedLoad(Rec, getPointerAlign());

lib/CodeGen/CGExpr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2859,9 +2859,9 @@ void CodeGenFunction::EmitCfiCheckFail() {
28592859
EmitTrapCheck(DataIsNotNullPtr);
28602860

28612861
llvm::StructType *SourceLocationTy =
2862-
llvm::StructType::get(VoidPtrTy, Int32Ty, Int32Ty, nullptr);
2862+
llvm::StructType::get(VoidPtrTy, Int32Ty, Int32Ty);
28632863
llvm::StructType *CfiCheckFailDataTy =
2864-
llvm::StructType::get(Int8Ty, SourceLocationTy, VoidPtrTy, nullptr);
2864+
llvm::StructType::get(Int8Ty, SourceLocationTy, VoidPtrTy);
28652865

28662866
llvm::Value *V = Builder.CreateConstGEP2_32(
28672867
CfiCheckFailDataTy,

lib/CodeGen/CGExprConstant.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1361,9 +1361,8 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value,
13611361
Value.getComplexIntImag());
13621362

13631363
// FIXME: the target may want to specify that this is packed.
1364-
llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
1365-
Complex[1]->getType(),
1366-
nullptr);
1364+
llvm::StructType *STy =
1365+
llvm::StructType::get(Complex[0]->getType(), Complex[1]->getType());
13671366
return llvm::ConstantStruct::get(STy, Complex);
13681367
}
13691368
case APValue::Float: {
@@ -1384,9 +1383,8 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value,
13841383
Value.getComplexFloatImag());
13851384

13861385
// FIXME: the target may want to specify that this is packed.
1387-
llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
1388-
Complex[1]->getType(),
1389-
nullptr);
1386+
llvm::StructType *STy =
1387+
llvm::StructType::get(Complex[0]->getType(), Complex[1]->getType());
13901388
return llvm::ConstantStruct::get(STy, Complex);
13911389
}
13921390
case APValue::Vector: {

0 commit comments

Comments
 (0)