r302572 - Suppress all uses of LLVM_END_WITH_NULL. NFC.
Mikael Holmén via cfe-commits
cfe-commits at lists.llvm.org
Wed May 10 00:52:12 PDT 2017
On 05/10/2017 09:37 AM, Mikael Holmén via cfe-commits wrote:
> Hi,
>
> This commit gives a warning with clang 3.6:
>
> In file included from
> ../tools/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp:17:
>
> ../tools/clang/lib/StaticAnalyzer/Checkers/SelectorExtras.h:23:40:
> error: braces around scalar initializer [-Werror]
> SmallVector<IdentifierInfo *, 10> II{{&Ctx.Idents.get(IIs)...}};
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> ../tools/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp:236:11:
> note: in instantiation of function template specialization
> 'clang::ento::getKeywordSelector<const char>' requested here
> getKeywordSelector(Ctx, "caseInsensitiveCompare"),
> ^
> 1 error generated.
>
> With 3.9 and 4.0 I don't see the warning. Is this a bug in 3.6 or what?
>
> Are we supposed to not use an old clang as 3.6 to compile?
>
http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
The above link says clang 3.1 should work.
Could you make the code compile without warnings also for 3.6?
Regards,
Mikael
> Regards,
> Mikael
>
>
> On 05/09/2017 09:31 PM, Serge Guelton via cfe-commits wrote:
>> Author: serge_sans_paille
>> Date: Tue May 9 14:31:30 2017
>> New Revision: 302572
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=302572&view=rev
>> Log:
>> 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
>>
>> Modified:
>> cfe/trunk/lib/CodeGen/CGBlocks.cpp
>> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> cfe/trunk/lib/CodeGen/CGCUDANV.cpp
>> cfe/trunk/lib/CodeGen/CGCleanup.cpp
>> cfe/trunk/lib/CodeGen/CGException.cpp
>> cfe/trunk/lib/CodeGen/CGExpr.cpp
>> cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>> cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>> cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>> cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>> cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>> cfe/trunk/lib/CodeGen/TargetInfo.cpp
>> cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
>> cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
>> cfe/trunk/lib/StaticAnalyzer/Checkers/SelectorExtras.h
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue May 9 14:31:30 2017
>> @@ -961,9 +961,8 @@ llvm::Type *CodeGenModule::getBlockDescr
>> // const char *signature; // the block signature
>> // const char *layout; // reserved
>> // };
>> - BlockDescriptorType =
>> - llvm::StructType::create("struct.__block_descriptor",
>> - UnsignedLongTy, UnsignedLongTy, nullptr);
>> + BlockDescriptorType = llvm::StructType::create(
>> + "struct.__block_descriptor", UnsignedLongTy, UnsignedLongTy);
>>
>> // Now form a pointer to that.
>> unsigned AddrSpace = 0;
>> @@ -987,9 +986,8 @@ llvm::Type *CodeGenModule::getGenericBlo
>> // struct __block_descriptor *__descriptor;
>> // };
>> GenericBlockLiteralType =
>> - llvm::StructType::create("struct.__block_literal_generic",
>> - VoidPtrTy, IntTy, IntTy, VoidPtrTy,
>> - BlockDescPtrTy, nullptr);
>> + llvm::StructType::create("struct.__block_literal_generic",
>> VoidPtrTy,
>> + IntTy, IntTy, VoidPtrTy, BlockDescPtrTy);
>>
>> return GenericBlockLiteralType;
>> }
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue May 9 14:31:30 2017
>> @@ -4571,7 +4571,7 @@ Value *CodeGenFunction::EmitARMBuiltinEx
>> Function *F = CGM.getIntrinsic(BuiltinID ==
>> ARM::BI__builtin_arm_stlex
>> ? Intrinsic::arm_stlexd
>> : Intrinsic::arm_strexd);
>> - llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty, nullptr);
>> + llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty);
>>
>> Address Tmp = CreateMemTemp(E->getArg(0)->getType());
>> Value *Val = EmitScalarExpr(E->getArg(0));
>> @@ -5401,7 +5401,7 @@ Value *CodeGenFunction::EmitAArch64Built
>> Function *F = CGM.getIntrinsic(BuiltinID ==
>> AArch64::BI__builtin_arm_stlex
>> ? Intrinsic::aarch64_stlxp
>> : Intrinsic::aarch64_stxp);
>> - llvm::Type *STy = llvm::StructType::get(Int64Ty, Int64Ty, nullptr);
>> + llvm::Type *STy = llvm::StructType::get(Int64Ty, Int64Ty);
>>
>> Address Tmp = CreateMemTemp(E->getArg(0)->getType());
>> EmitAnyExprToMem(E->getArg(0), Tmp, Qualifiers(), /*init*/ true);
>> @@ -7373,8 +7373,8 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>> // unsigned int __cpu_type;
>> // unsigned int __cpu_subtype;
>> // unsigned int __cpu_features[1];
>> - llvm::Type *STy = llvm::StructType::get(
>> - Int32Ty, Int32Ty, Int32Ty, llvm::ArrayType::get(Int32Ty, 1),
>> nullptr);
>> + llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty, Int32Ty,
>> +
>> llvm::ArrayType::get(Int32Ty, 1));
>>
>> // Grab the global __cpu_model.
>> llvm::Constant *CpuModel = CGM.CreateRuntimeVariable(STy,
>> "__cpu_model");
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCUDANV.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCUDANV.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGCUDANV.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCUDANV.cpp Tue May 9 14:31:30 2017
>> @@ -265,7 +265,7 @@ llvm::Function *CGNVCUDARuntime::makeMod
>> "__cudaRegisterFatBinary");
>> // struct { int magic, int version, void * gpu_binary, void *
>> dont_care };
>> llvm::StructType *FatbinWrapperTy =
>> - llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy,
>> nullptr);
>> + llvm::StructType::get(IntTy, IntTy, VoidPtrTy, VoidPtrTy);
>>
>> llvm::Function *ModuleCtorFunc = llvm::Function::Create(
>> llvm::FunctionType::get(VoidTy, VoidPtrTy, false),
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Tue May 9 14:31:30 2017
>> @@ -51,8 +51,7 @@ DominatingValue<RValue>::saved_type::sav
>> if (rv.isComplex()) {
>> CodeGenFunction::ComplexPairTy V = rv.getComplexVal();
>> llvm::Type *ComplexTy =
>> - llvm::StructType::get(V.first->getType(), V.second->getType(),
>> - (void*) nullptr);
>> + llvm::StructType::get(V.first->getType(), V.second->getType());
>> Address addr = CGF.CreateDefaultAlignTempAlloca(ComplexTy,
>> "saved-complex");
>> CGF.Builder.CreateStore(V.first,
>> CGF.Builder.CreateStructGEP(addr, 0,
>> CharUnits()));
>>
>> Modified: cfe/trunk/lib/CodeGen/CGException.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGException.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue May 9 14:31:30 2017
>> @@ -765,8 +765,8 @@ llvm::BasicBlock *CodeGenFunction::EmitL
>> llvm::BasicBlock *lpad = createBasicBlock("lpad");
>> EmitBlock(lpad);
>>
>> - llvm::LandingPadInst *LPadInst = Builder.CreateLandingPad(
>> - llvm::StructType::get(Int8PtrTy, Int32Ty, nullptr), 0);
>> + llvm::LandingPadInst *LPadInst =
>> + Builder.CreateLandingPad(llvm::StructType::get(Int8PtrTy,
>> Int32Ty), 0);
>>
>> llvm::Value *LPadExn = Builder.CreateExtractValue(LPadInst, 0);
>> Builder.CreateStore(LPadExn, getExceptionSlot());
>> @@ -1310,8 +1310,8 @@ llvm::BasicBlock *CodeGenFunction::getTe
>> if (!CurFn->hasPersonalityFn())
>> CurFn->setPersonalityFn(getOpaquePersonalityFn(CGM, Personality));
>>
>> - llvm::LandingPadInst *LPadInst = Builder.CreateLandingPad(
>> - llvm::StructType::get(Int8PtrTy, Int32Ty, nullptr), 0);
>> + llvm::LandingPadInst *LPadInst =
>> + Builder.CreateLandingPad(llvm::StructType::get(Int8PtrTy,
>> Int32Ty), 0);
>> LPadInst->addClause(getCatchAllValue(*this));
>>
>> llvm::Value *Exn = nullptr;
>> @@ -1387,8 +1387,7 @@ llvm::BasicBlock *CodeGenFunction::getEH
>> llvm::Value *Exn = getExceptionFromSlot();
>> llvm::Value *Sel = getSelectorFromSlot();
>>
>> - llvm::Type *LPadType = llvm::StructType::get(Exn->getType(),
>> - Sel->getType(), nullptr);
>> + llvm::Type *LPadType = llvm::StructType::get(Exn->getType(),
>> Sel->getType());
>> llvm::Value *LPadVal = llvm::UndefValue::get(LPadType);
>> LPadVal = Builder.CreateInsertValue(LPadVal, Exn, 0, "lpad.val");
>> LPadVal = Builder.CreateInsertValue(LPadVal, Sel, 1, "lpad.val");
>> @@ -1747,7 +1746,7 @@ void CodeGenFunction::EmitSEHExceptionCo
>> // };
>> // int exceptioncode =
>> exception_pointers->ExceptionRecord->ExceptionCode;
>> llvm::Type *RecordTy = CGM.Int32Ty->getPointerTo();
>> - llvm::Type *PtrsTy = llvm::StructType::get(RecordTy, CGM.VoidPtrTy,
>> nullptr);
>> + llvm::Type *PtrsTy = llvm::StructType::get(RecordTy, CGM.VoidPtrTy);
>> llvm::Value *Ptrs = Builder.CreateBitCast(SEHInfo,
>> PtrsTy->getPointerTo());
>> llvm::Value *Rec = Builder.CreateStructGEP(PtrsTy, Ptrs, 0);
>> Rec = Builder.CreateAlignedLoad(Rec, getPointerAlign());
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue May 9 14:31:30 2017
>> @@ -2859,9 +2859,9 @@ void CodeGenFunction::EmitCfiCheckFail()
>> EmitTrapCheck(DataIsNotNullPtr);
>>
>> llvm::StructType *SourceLocationTy =
>> - llvm::StructType::get(VoidPtrTy, Int32Ty, Int32Ty, nullptr);
>> + llvm::StructType::get(VoidPtrTy, Int32Ty, Int32Ty);
>> llvm::StructType *CfiCheckFailDataTy =
>> - llvm::StructType::get(Int8Ty, SourceLocationTy, VoidPtrTy,
>> nullptr);
>> + llvm::StructType::get(Int8Ty, SourceLocationTy, VoidPtrTy);
>>
>> llvm::Value *V = Builder.CreateConstGEP2_32(
>> CfiCheckFailDataTy,
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Tue May 9 14:31:30 2017
>> @@ -1361,9 +1361,8 @@ llvm::Constant *CodeGenModule::EmitConst
>> Value.getComplexIntImag());
>>
>> // FIXME: the target may want to specify that this is packed.
>> - llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
>> - Complex[1]->getType(),
>> - nullptr);
>> + llvm::StructType *STy =
>> + llvm::StructType::get(Complex[0]->getType(),
>> Complex[1]->getType());
>> return llvm::ConstantStruct::get(STy, Complex);
>> }
>> case APValue::Float: {
>> @@ -1384,9 +1383,8 @@ llvm::Constant *CodeGenModule::EmitConst
>> Value.getComplexFloatImag());
>>
>> // FIXME: the target may want to specify that this is packed.
>> - llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
>> - Complex[1]->getType(),
>> - nullptr);
>> + llvm::StructType *STy =
>> + llvm::StructType::get(Complex[0]->getType(),
>> Complex[1]->getType());
>> return llvm::ConstantStruct::get(STy, Complex);
>> }
>> case APValue::Vector: {
>>
>> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue May 9 14:31:30 2017
>> @@ -34,7 +34,6 @@
>> #include "llvm/IR/LLVMContext.h"
>> #include "llvm/IR/Module.h"
>> #include "llvm/Support/Compiler.h"
>> -#include <cstdarg>
>>
>> using namespace clang;
>> using namespace CodeGen;
>> @@ -58,17 +57,13 @@ public:
>>
>> /// Initialises the lazy function with the name, return type, and
>> the types
>> /// of the arguments.
>> - LLVM_END_WITH_NULL
>> - void init(CodeGenModule *Mod, const char *name, llvm::Type *RetTy,
>> ...) {
>> + template <typename... Tys>
>> + void init(CodeGenModule *Mod, const char *name, llvm::Type *RetTy,
>> + Tys *... Types) {
>> CGM = Mod;
>> FunctionName = name;
>> Function = nullptr;
>> - std::vector<llvm::Type *> ArgTys;
>> - va_list Args;
>> - va_start(Args, RetTy);
>> - while (llvm::Type *ArgTy = va_arg(Args, llvm::Type *))
>> - ArgTys.push_back(ArgTy);
>> - va_end(Args);
>> + std::vector<llvm::Type *> ArgTys{{Types...}};
>> FTy = llvm::FunctionType::get(RetTy, ArgTys, false);
>> }
>>
>> @@ -603,11 +598,10 @@ protected:
>> public:
>> CGObjCGCC(CodeGenModule &Mod) : CGObjCGNU(Mod, 8, 2) {
>> // IMP objc_msg_lookup(id, SEL);
>> - MsgLookupFn.init(&CGM, "objc_msg_lookup", IMPTy, IdTy, SelectorTy,
>> - nullptr);
>> + MsgLookupFn.init(&CGM, "objc_msg_lookup", IMPTy, IdTy, SelectorTy);
>> // IMP objc_msg_lookup_super(struct objc_super*, SEL);
>> MsgLookupSuperFn.init(&CGM, "objc_msg_lookup_super", IMPTy,
>> - PtrToObjCSuperTy, SelectorTy, nullptr);
>> + PtrToObjCSuperTy, SelectorTy);
>> }
>> };
>>
>> @@ -702,52 +696,51 @@ class CGObjCGNUstep : public CGObjCGNU {
>> CGObjCGNUstep(CodeGenModule &Mod) : CGObjCGNU(Mod, 9, 3) {
>> const ObjCRuntime &R = CGM.getLangOpts().ObjCRuntime;
>>
>> - llvm::StructType *SlotStructTy = llvm::StructType::get(PtrTy,
>> - PtrTy, PtrTy, IntTy, IMPTy, nullptr);
>> + llvm::StructType *SlotStructTy =
>> + llvm::StructType::get(PtrTy, PtrTy, PtrTy, IntTy, IMPTy);
>> SlotTy = llvm::PointerType::getUnqual(SlotStructTy);
>> // Slot_t objc_msg_lookup_sender(id *receiver, SEL selector, id
>> sender);
>> SlotLookupFn.init(&CGM, "objc_msg_lookup_sender", SlotTy,
>> PtrToIdTy,
>> - SelectorTy, IdTy, nullptr);
>> + SelectorTy, IdTy);
>> // Slot_t objc_msg_lookup_super(struct objc_super*, SEL);
>> SlotLookupSuperFn.init(&CGM, "objc_slot_lookup_super", SlotTy,
>> - PtrToObjCSuperTy, SelectorTy, nullptr);
>> + PtrToObjCSuperTy, SelectorTy);
>> // If we're in ObjC++ mode, then we want to make
>> if (CGM.getLangOpts().CPlusPlus) {
>> llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
>> // void *__cxa_begin_catch(void *e)
>> - EnterCatchFn.init(&CGM, "__cxa_begin_catch", PtrTy, PtrTy,
>> nullptr);
>> + EnterCatchFn.init(&CGM, "__cxa_begin_catch", PtrTy, PtrTy);
>> // void __cxa_end_catch(void)
>> - ExitCatchFn.init(&CGM, "__cxa_end_catch", VoidTy, nullptr);
>> + ExitCatchFn.init(&CGM, "__cxa_end_catch", VoidTy);
>> // void _Unwind_Resume_or_Rethrow(void*)
>> ExceptionReThrowFn.init(&CGM, "_Unwind_Resume_or_Rethrow",
>> VoidTy,
>> - PtrTy, nullptr);
>> + PtrTy);
>> } else if (R.getVersion() >= VersionTuple(1, 7)) {
>> llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
>> // id objc_begin_catch(void *e)
>> - EnterCatchFn.init(&CGM, "objc_begin_catch", IdTy, PtrTy,
>> nullptr);
>> + EnterCatchFn.init(&CGM, "objc_begin_catch", IdTy, PtrTy);
>> // void objc_end_catch(void)
>> - ExitCatchFn.init(&CGM, "objc_end_catch", VoidTy, nullptr);
>> + ExitCatchFn.init(&CGM, "objc_end_catch", VoidTy);
>> // void _Unwind_Resume_or_Rethrow(void*)
>> - ExceptionReThrowFn.init(&CGM, "objc_exception_rethrow", VoidTy,
>> - PtrTy, nullptr);
>> + ExceptionReThrowFn.init(&CGM, "objc_exception_rethrow",
>> VoidTy, PtrTy);
>> }
>> llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
>> SetPropertyAtomic.init(&CGM, "objc_setProperty_atomic", VoidTy,
>> IdTy,
>> - SelectorTy, IdTy, PtrDiffTy, nullptr);
>> + SelectorTy, IdTy, PtrDiffTy);
>> SetPropertyAtomicCopy.init(&CGM,
>> "objc_setProperty_atomic_copy", VoidTy,
>> - IdTy, SelectorTy, IdTy, PtrDiffTy, nullptr);
>> + IdTy, SelectorTy, IdTy, PtrDiffTy);
>> SetPropertyNonAtomic.init(&CGM, "objc_setProperty_nonatomic",
>> VoidTy,
>> - IdTy, SelectorTy, IdTy, PtrDiffTy, nullptr);
>> + IdTy, SelectorTy, IdTy, PtrDiffTy);
>> SetPropertyNonAtomicCopy.init(&CGM,
>> "objc_setProperty_nonatomic_copy",
>> - VoidTy, IdTy, SelectorTy, IdTy, PtrDiffTy, nullptr);
>> + VoidTy, IdTy, SelectorTy, IdTy,
>> PtrDiffTy);
>> // void objc_setCppObjectAtomic(void *dest, const void *src, void
>> // *helper);
>> CxxAtomicObjectSetFn.init(&CGM, "objc_setCppObjectAtomic",
>> VoidTy, PtrTy,
>> - PtrTy, PtrTy, nullptr);
>> + PtrTy, PtrTy);
>> // void objc_getCppObjectAtomic(void *dest, const void *src, void
>> // *helper);
>> CxxAtomicObjectGetFn.init(&CGM, "objc_getCppObjectAtomic",
>> VoidTy, PtrTy,
>> - PtrTy, PtrTy, nullptr);
>> + PtrTy, PtrTy);
>> }
>>
>> llvm::Constant *GetCppAtomicObjectGetFunction() override {
>> @@ -849,14 +842,14 @@ protected:
>> public:
>> CGObjCObjFW(CodeGenModule &Mod): CGObjCGNU(Mod, 9, 3) {
>> // IMP objc_msg_lookup(id, SEL);
>> - MsgLookupFn.init(&CGM, "objc_msg_lookup", IMPTy, IdTy,
>> SelectorTy, nullptr);
>> + MsgLookupFn.init(&CGM, "objc_msg_lookup", IMPTy, IdTy, SelectorTy);
>> MsgLookupFnSRet.init(&CGM, "objc_msg_lookup_stret", IMPTy, IdTy,
>> - SelectorTy, nullptr);
>> + SelectorTy);
>> // IMP objc_msg_lookup_super(struct objc_super*, SEL);
>> MsgLookupSuperFn.init(&CGM, "objc_msg_lookup_super", IMPTy,
>> - PtrToObjCSuperTy, SelectorTy, nullptr);
>> + PtrToObjCSuperTy, SelectorTy);
>> MsgLookupSuperFnSRet.init(&CGM, "objc_msg_lookup_super_stret",
>> IMPTy,
>> - PtrToObjCSuperTy, SelectorTy, nullptr);
>> + PtrToObjCSuperTy, SelectorTy);
>> }
>> };
>> } // end anonymous namespace
>> @@ -945,35 +938,34 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm,
>> }
>> PtrToIdTy = llvm::PointerType::getUnqual(IdTy);
>>
>> - ObjCSuperTy = llvm::StructType::get(IdTy, IdTy, nullptr);
>> + ObjCSuperTy = llvm::StructType::get(IdTy, IdTy);
>> PtrToObjCSuperTy = llvm::PointerType::getUnqual(ObjCSuperTy);
>>
>> llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
>>
>> // void objc_exception_throw(id);
>> - ExceptionThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy,
>> nullptr);
>> - ExceptionReThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy,
>> nullptr);
>> + ExceptionThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy);
>> + ExceptionReThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy);
>> // int objc_sync_enter(id);
>> - SyncEnterFn.init(&CGM, "objc_sync_enter", IntTy, IdTy, nullptr);
>> + SyncEnterFn.init(&CGM, "objc_sync_enter", IntTy, IdTy);
>> // int objc_sync_exit(id);
>> - SyncExitFn.init(&CGM, "objc_sync_exit", IntTy, IdTy, nullptr);
>> + SyncExitFn.init(&CGM, "objc_sync_exit", IntTy, IdTy);
>>
>> // void objc_enumerationMutation (id)
>> - EnumerationMutationFn.init(&CGM, "objc_enumerationMutation", VoidTy,
>> - IdTy, nullptr);
>> + EnumerationMutationFn.init(&CGM, "objc_enumerationMutation",
>> VoidTy, IdTy);
>>
>> // id objc_getProperty(id, SEL, ptrdiff_t, BOOL)
>> GetPropertyFn.init(&CGM, "objc_getProperty", IdTy, IdTy, SelectorTy,
>> - PtrDiffTy, BoolTy, nullptr);
>> + PtrDiffTy, BoolTy);
>> // void objc_setProperty(id, SEL, ptrdiff_t, id, BOOL, BOOL)
>> SetPropertyFn.init(&CGM, "objc_setProperty", VoidTy, IdTy, SelectorTy,
>> - PtrDiffTy, IdTy, BoolTy, BoolTy, nullptr);
>> + PtrDiffTy, IdTy, BoolTy, BoolTy);
>> // void objc_setPropertyStruct(void*, void*, ptrdiff_t, BOOL, BOOL)
>> - GetStructPropertyFn.init(&CGM, "objc_getPropertyStruct", VoidTy,
>> PtrTy, PtrTy,
>> - PtrDiffTy, BoolTy, BoolTy, nullptr);
>> + GetStructPropertyFn.init(&CGM, "objc_getPropertyStruct", VoidTy,
>> PtrTy, PtrTy,
>> + PtrDiffTy, BoolTy, BoolTy);
>> // void objc_setPropertyStruct(void*, void*, ptrdiff_t, BOOL, BOOL)
>> - SetStructPropertyFn.init(&CGM, "objc_setPropertyStruct", VoidTy,
>> PtrTy, PtrTy,
>> - PtrDiffTy, BoolTy, BoolTy, nullptr);
>> + SetStructPropertyFn.init(&CGM, "objc_setPropertyStruct", VoidTy,
>> PtrTy, PtrTy,
>> + PtrDiffTy, BoolTy, BoolTy);
>>
>> // IMP type
>> llvm::Type *IMPArgs[] = { IdTy, SelectorTy };
>> @@ -997,21 +989,19 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm,
>> // Get functions needed in GC mode
>>
>> // id objc_assign_ivar(id, id, ptrdiff_t);
>> - IvarAssignFn.init(&CGM, "objc_assign_ivar", IdTy, IdTy, IdTy,
>> PtrDiffTy,
>> - nullptr);
>> + IvarAssignFn.init(&CGM, "objc_assign_ivar", IdTy, IdTy, IdTy,
>> PtrDiffTy);
>> // id objc_assign_strongCast (id, id*)
>> StrongCastAssignFn.init(&CGM, "objc_assign_strongCast", IdTy, IdTy,
>> - PtrToIdTy, nullptr);
>> + PtrToIdTy);
>> // id objc_assign_global(id, id*);
>> - GlobalAssignFn.init(&CGM, "objc_assign_global", IdTy, IdTy,
>> PtrToIdTy,
>> - nullptr);
>> + GlobalAssignFn.init(&CGM, "objc_assign_global", IdTy, IdTy,
>> PtrToIdTy);
>> // id objc_assign_weak(id, id*);
>> - WeakAssignFn.init(&CGM, "objc_assign_weak", IdTy, IdTy,
>> PtrToIdTy, nullptr);
>> + WeakAssignFn.init(&CGM, "objc_assign_weak", IdTy, IdTy, PtrToIdTy);
>> // id objc_read_weak(id*);
>> - WeakReadFn.init(&CGM, "objc_read_weak", IdTy, PtrToIdTy, nullptr);
>> + WeakReadFn.init(&CGM, "objc_read_weak", IdTy, PtrToIdTy);
>> // void *objc_memmove_collectable(void*, void *, size_t);
>> MemMoveFn.init(&CGM, "objc_memmove_collectable", PtrTy, PtrTy,
>> PtrTy,
>> - SizeTy, nullptr);
>> + SizeTy);
>> }
>> }
>>
>> @@ -1317,7 +1307,7 @@ CGObjCGNU::GenerateMessageSendSuper(Code
>> }
>> }
>> // Cast the pointer to a simplified version of the class structure
>> - llvm::Type *CastTy = llvm::StructType::get(IdTy, IdTy, nullptr);
>> + llvm::Type *CastTy = llvm::StructType::get(IdTy, IdTy);
>> ReceiverClass = Builder.CreateBitCast(ReceiverClass,
>>
>> llvm::PointerType::getUnqual(CastTy));
>> // Get the superclass pointer
>> @@ -1326,8 +1316,8 @@ CGObjCGNU::GenerateMessageSendSuper(Code
>> ReceiverClass =
>> Builder.CreateAlignedLoad(ReceiverClass, CGF.getPointerAlign());
>> // Construct the structure used to look up the IMP
>> - llvm::StructType *ObjCSuperTy = llvm::StructType::get(
>> - Receiver->getType(), IdTy, nullptr);
>> + llvm::StructType *ObjCSuperTy =
>> + llvm::StructType::get(Receiver->getType(), IdTy);
>>
>> // FIXME: Is this really supposed to be a dynamic alloca?
>> Address ObjCSuper = Address(Builder.CreateAlloca(ObjCSuperTy),
>> @@ -1565,11 +1555,8 @@ GenerateIvarList(ArrayRef<llvm::Constant
>> IvarList.addInt(IntTy, (int)IvarNames.size());
>>
>> // Get the ivar structure type.
>> - llvm::StructType *ObjCIvarTy = llvm::StructType::get(
>> - PtrToInt8Ty,
>> - PtrToInt8Ty,
>> - IntTy,
>> - nullptr);
>> + llvm::StructType *ObjCIvarTy =
>> + llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, IntTy);
>>
>> // Array of ivar structures.
>> auto Ivars = IvarList.beginArray(ObjCIvarTy);
>> @@ -1611,7 +1598,7 @@ llvm::Constant *CGObjCGNU::GenerateClass
>> // anyway; the classes will still work with the GNU runtime, they
>> will just
>> // be ignored.
>> llvm::StructType *ClassTy = llvm::StructType::get(
>> - PtrToInt8Ty, // isa
>> + PtrToInt8Ty, // isa
>> PtrToInt8Ty, // super_class
>> PtrToInt8Ty, // name
>> LongTy, // version
>> @@ -1620,18 +1607,18 @@ llvm::Constant *CGObjCGNU::GenerateClass
>> IVars->getType(), // ivars
>> Methods->getType(), // methods
>> // These are all filled in by the runtime, so we pretend
>> - PtrTy, // dtable
>> - PtrTy, // subclass_list
>> - PtrTy, // sibling_class
>> - PtrTy, // protocols
>> - PtrTy, // gc_object_type
>> + PtrTy, // dtable
>> + PtrTy, // subclass_list
>> + PtrTy, // sibling_class
>> + PtrTy, // protocols
>> + PtrTy, // gc_object_type
>> // New ABI:
>> LongTy, // abi_version
>> IvarOffsets->getType(), // ivar_offsets
>> Properties->getType(), // properties
>> IntPtrTy, // strong_pointers
>> - IntPtrTy, // weak_pointers
>> - nullptr);
>> + IntPtrTy // weak_pointers
>> + );
>>
>> ConstantInitBuilder Builder(CGM);
>> auto Elements = Builder.beginStruct(ClassTy);
>>
>> Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue May 9 14:31:30 2017
>> @@ -105,8 +105,8 @@ private:
>> llvm::Constant *getMessageSendFp2retFn() const {
>> llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
>> llvm::Type *longDoubleType = llvm::Type::getX86_FP80Ty(VMContext);
>> - llvm::Type *resultType =
>> - llvm::StructType::get(longDoubleType, longDoubleType, nullptr);
>> + llvm::Type *resultType =
>> + llvm::StructType::get(longDoubleType, longDoubleType);
>>
>> return CGM.CreateRuntimeFunction(llvm::FunctionType::get(resultType,
>> params,
>> true),
>> @@ -5506,17 +5506,15 @@ ObjCCommonTypesHelper::ObjCCommonTypesHe
>> // char *name;
>> // char *attributes;
>> // }
>> - PropertyTy = llvm::StructType::create("struct._prop_t",
>> - Int8PtrTy, Int8PtrTy, nullptr);
>> + PropertyTy = llvm::StructType::create("struct._prop_t", Int8PtrTy,
>> Int8PtrTy);
>>
>> // struct _prop_list_t {
>> // uint32_t entsize; // sizeof(struct _prop_t)
>> // uint32_t count_of_properties;
>> // struct _prop_t prop_list[count_of_properties];
>> // }
>> - PropertyListTy =
>> - llvm::StructType::create("struct._prop_list_t", IntTy, IntTy,
>> - llvm::ArrayType::get(PropertyTy, 0),
>> nullptr);
>> + PropertyListTy = llvm::StructType::create(
>> + "struct._prop_list_t", IntTy, IntTy,
>> llvm::ArrayType::get(PropertyTy, 0));
>> // struct _prop_list_t *
>> PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
>>
>> @@ -5525,9 +5523,8 @@ ObjCCommonTypesHelper::ObjCCommonTypesHe
>> // char *method_type;
>> // char *_imp;
>> // }
>> - MethodTy = llvm::StructType::create("struct._objc_method",
>> - SelectorPtrTy, Int8PtrTy,
>> Int8PtrTy,
>> - nullptr);
>> + MethodTy = llvm::StructType::create("struct._objc_method",
>> SelectorPtrTy,
>> + Int8PtrTy, Int8PtrTy);
>>
>> // struct _objc_cache *
>> CacheTy = llvm::StructType::create(VMContext, "struct._objc_cache");
>> @@ -5540,17 +5537,16 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // SEL name;
>> // char *types;
>> // }
>> - MethodDescriptionTy =
>> - llvm::StructType::create("struct._objc_method_description",
>> - SelectorPtrTy, Int8PtrTy, nullptr);
>> + MethodDescriptionTy = llvm::StructType::create(
>> + "struct._objc_method_description", SelectorPtrTy, Int8PtrTy);
>>
>> // struct _objc_method_description_list {
>> // int count;
>> // struct _objc_method_description[1];
>> // }
>> - MethodDescriptionListTy = llvm::StructType::create(
>> - "struct._objc_method_description_list", IntTy,
>> - llvm::ArrayType::get(MethodDescriptionTy, 0), nullptr);
>> + MethodDescriptionListTy =
>> +
>> llvm::StructType::create("struct._objc_method_description_list", IntTy,
>> +
>> llvm::ArrayType::get(MethodDescriptionTy, 0));
>>
>> // struct _objc_method_description_list *
>> MethodDescriptionListPtrTy =
>> @@ -5566,11 +5562,10 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // const char ** extendedMethodTypes;
>> // struct _objc_property_list *class_properties;
>> // }
>> - ProtocolExtensionTy =
>> - llvm::StructType::create("struct._objc_protocol_extension",
>> - IntTy, MethodDescriptionListPtrTy,
>> - MethodDescriptionListPtrTy,
>> PropertyListPtrTy,
>> - Int8PtrPtrTy, PropertyListPtrTy, nullptr);
>> + ProtocolExtensionTy = llvm::StructType::create(
>> + "struct._objc_protocol_extension", IntTy,
>> MethodDescriptionListPtrTy,
>> + MethodDescriptionListPtrTy, PropertyListPtrTy, Int8PtrPtrTy,
>> + PropertyListPtrTy);
>>
>> // struct _objc_protocol_extension *
>> ProtocolExtensionPtrTy =
>> llvm::PointerType::getUnqual(ProtocolExtensionTy);
>> @@ -5582,10 +5577,8 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>>
>> ProtocolListTy =
>> llvm::StructType::create(VMContext, "struct._objc_protocol_list");
>> - ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy),
>> - LongTy,
>> - llvm::ArrayType::get(ProtocolTy, 0),
>> - nullptr);
>> +
>> ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy),
>> LongTy,
>> + llvm::ArrayType::get(ProtocolTy, 0));
>>
>> // struct _objc_protocol {
>> // struct _objc_protocol_extension *isa;
>> @@ -5596,9 +5589,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // }
>> ProtocolTy->setBody(ProtocolExtensionPtrTy, Int8PtrTy,
>> llvm::PointerType::getUnqual(ProtocolListTy),
>> - MethodDescriptionListPtrTy,
>> - MethodDescriptionListPtrTy,
>> - nullptr);
>> + MethodDescriptionListPtrTy,
>> MethodDescriptionListPtrTy);
>>
>> // struct _objc_protocol_list *
>> ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
>> @@ -5612,8 +5603,8 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // char *ivar_type;
>> // int ivar_offset;
>> // }
>> - IvarTy = llvm::StructType::create("struct._objc_ivar",
>> - Int8PtrTy, Int8PtrTy, IntTy,
>> nullptr);
>> + IvarTy = llvm::StructType::create("struct._objc_ivar", Int8PtrTy,
>> Int8PtrTy,
>> + IntTy);
>>
>> // struct _objc_ivar_list *
>> IvarListTy =
>> @@ -5626,9 +5617,8 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy);
>>
>> // struct _objc_class_extension *
>> - ClassExtensionTy =
>> - llvm::StructType::create("struct._objc_class_extension",
>> - IntTy, Int8PtrTy, PropertyListPtrTy,
>> nullptr);
>> + ClassExtensionTy = llvm::StructType::create(
>> + "struct._objc_class_extension", IntTy, Int8PtrTy,
>> PropertyListPtrTy);
>> ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
>>
>> ClassTy = llvm::StructType::create(VMContext, "struct._objc_class");
>> @@ -5648,18 +5638,9 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // struct _objc_class_ext *ext;
>> // };
>> ClassTy->setBody(llvm::PointerType::getUnqual(ClassTy),
>> - llvm::PointerType::getUnqual(ClassTy),
>> - Int8PtrTy,
>> - LongTy,
>> - LongTy,
>> - LongTy,
>> - IvarListPtrTy,
>> - MethodListPtrTy,
>> - CachePtrTy,
>> - ProtocolListPtrTy,
>> - Int8PtrTy,
>> - ClassExtensionPtrTy,
>> - nullptr);
>> + llvm::PointerType::getUnqual(ClassTy), Int8PtrTy,
>> LongTy,
>> + LongTy, LongTy, IvarListPtrTy, MethodListPtrTy,
>> CachePtrTy,
>> + ProtocolListPtrTy, Int8PtrTy, ClassExtensionPtrTy);
>>
>> ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
>>
>> @@ -5673,12 +5654,10 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // struct _objc_property_list *instance_properties;// category's
>> @property
>> // struct _objc_property_list *class_properties;
>> // }
>> - CategoryTy =
>> - llvm::StructType::create("struct._objc_category",
>> - Int8PtrTy, Int8PtrTy, MethodListPtrTy,
>> - MethodListPtrTy, ProtocolListPtrTy,
>> - IntTy, PropertyListPtrTy,
>> PropertyListPtrTy,
>> - nullptr);
>> + CategoryTy = llvm::StructType::create(
>> + "struct._objc_category", Int8PtrTy, Int8PtrTy, MethodListPtrTy,
>> + MethodListPtrTy, ProtocolListPtrTy, IntTy, PropertyListPtrTy,
>> + PropertyListPtrTy);
>>
>> // Global metadata structures
>>
>> @@ -5689,10 +5668,9 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // short cat_def_cnt;
>> // char *defs[cls_def_cnt + cat_def_cnt];
>> // }
>> - SymtabTy =
>> - llvm::StructType::create("struct._objc_symtab",
>> - LongTy, SelectorPtrTy, ShortTy, ShortTy,
>> - llvm::ArrayType::get(Int8PtrTy, 0),
>> nullptr);
>> + SymtabTy = llvm::StructType::create("struct._objc_symtab", LongTy,
>> + SelectorPtrTy, ShortTy, ShortTy,
>> + llvm::ArrayType::get(Int8PtrTy,
>> 0));
>> SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy);
>>
>> // struct _objc_module {
>> @@ -5701,10 +5679,8 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // char *name;
>> // struct _objc_symtab* symtab;
>> // }
>> - ModuleTy =
>> - llvm::StructType::create("struct._objc_module",
>> - LongTy, LongTy, Int8PtrTy, SymtabPtrTy,
>> nullptr);
>> -
>> + ModuleTy = llvm::StructType::create("struct._objc_module", LongTy,
>> LongTy,
>> + Int8PtrTy, SymtabPtrTy);
>>
>> // FIXME: This is the size of the setjmp buffer and should be target
>> // specific. 18 is what's used on 32-bit X86.
>> @@ -5713,10 +5689,9 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
>> // Exceptions
>> llvm::Type *StackPtrTy = llvm::ArrayType::get(CGM.Int8PtrTy, 4);
>>
>> - ExceptionDataTy =
>> - llvm::StructType::create("struct._objc_exception_data",
>> -
>> llvm::ArrayType::get(CGM.Int32Ty,SetJmpBufferSize),
>> - StackPtrTy, nullptr);
>> + ExceptionDataTy = llvm::StructType::create(
>> + "struct._objc_exception_data",
>> + llvm::ArrayType::get(CGM.Int32Ty, SetJmpBufferSize), StackPtrTy);
>> }
>>
>> ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule
>> &cgm)
>> @@ -5727,8 +5702,8 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // struct _objc_method method_list[method_count];
>> // }
>> MethodListnfABITy =
>> - llvm::StructType::create("struct.__method_list_t", IntTy, IntTy,
>> - llvm::ArrayType::get(MethodTy, 0),
>> nullptr);
>> + llvm::StructType::create("struct.__method_list_t", IntTy, IntTy,
>> + llvm::ArrayType::get(MethodTy, 0));
>> // struct method_list_t *
>> MethodListnfABIPtrTy =
>> llvm::PointerType::getUnqual(MethodListnfABITy);
>>
>> @@ -5752,14 +5727,12 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> ProtocolListnfABITy =
>> llvm::StructType::create(VMContext, "struct._objc_protocol_list");
>>
>> - ProtocolnfABITy =
>> - llvm::StructType::create("struct._protocol_t", ObjectPtrTy,
>> Int8PtrTy,
>> -
>> llvm::PointerType::getUnqual(ProtocolListnfABITy),
>> - MethodListnfABIPtrTy, MethodListnfABIPtrTy,
>> - MethodListnfABIPtrTy, MethodListnfABIPtrTy,
>> - PropertyListPtrTy, IntTy, IntTy,
>> Int8PtrPtrTy,
>> - Int8PtrTy, PropertyListPtrTy,
>> - nullptr);
>> + ProtocolnfABITy = llvm::StructType::create(
>> + "struct._protocol_t", ObjectPtrTy, Int8PtrTy,
>> + llvm::PointerType::getUnqual(ProtocolListnfABITy),
>> MethodListnfABIPtrTy,
>> + MethodListnfABIPtrTy, MethodListnfABIPtrTy, MethodListnfABIPtrTy,
>> + PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy, Int8PtrTy,
>> + PropertyListPtrTy);
>>
>> // struct _protocol_t*
>> ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy);
>> @@ -5769,8 +5742,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // struct _protocol_t *[protocol_count];
>> // }
>> ProtocolListnfABITy->setBody(LongTy,
>> -
>> llvm::ArrayType::get(ProtocolnfABIPtrTy, 0),
>> - nullptr);
>> +
>> llvm::ArrayType::get(ProtocolnfABIPtrTy, 0));
>>
>> // struct _objc_protocol_list*
>> ProtocolListnfABIPtrTy =
>> llvm::PointerType::getUnqual(ProtocolListnfABITy);
>> @@ -5784,7 +5756,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // }
>> IvarnfABITy = llvm::StructType::create(
>> "struct._ivar_t", llvm::PointerType::getUnqual(IvarOffsetVarTy),
>> - Int8PtrTy, Int8PtrTy, IntTy, IntTy, nullptr);
>> + Int8PtrTy, Int8PtrTy, IntTy, IntTy);
>>
>> // struct _ivar_list_t {
>> // uint32 entsize; // sizeof(struct _ivar_t)
>> @@ -5792,8 +5764,8 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // struct _iver_t list[count];
>> // }
>> IvarListnfABITy =
>> - llvm::StructType::create("struct._ivar_list_t", IntTy, IntTy,
>> - llvm::ArrayType::get(IvarnfABITy, 0),
>> nullptr);
>> + llvm::StructType::create("struct._ivar_list_t", IntTy, IntTy,
>> + llvm::ArrayType::get(IvarnfABITy, 0));
>>
>> IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy);
>>
>> @@ -5812,13 +5784,10 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // }
>>
>> // FIXME. Add 'reserved' field in 64bit abi mode!
>> - ClassRonfABITy = llvm::StructType::create("struct._class_ro_t",
>> - IntTy, IntTy, IntTy,
>> Int8PtrTy,
>> - Int8PtrTy,
>> MethodListnfABIPtrTy,
>> - ProtocolListnfABIPtrTy,
>> - IvarListnfABIPtrTy,
>> - Int8PtrTy,
>> PropertyListPtrTy,
>> - nullptr);
>> + ClassRonfABITy = llvm::StructType::create(
>> + "struct._class_ro_t", IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
>> + MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
>> + Int8PtrTy, PropertyListPtrTy);
>>
>> // ImpnfABITy - LLVM for id (*)(id, SEL, ...)
>> llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
>> @@ -5835,11 +5804,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>>
>> ClassnfABITy = llvm::StructType::create(VMContext, "struct._class_t");
>> ClassnfABITy->setBody(llvm::PointerType::getUnqual(ClassnfABITy),
>> - llvm::PointerType::getUnqual(ClassnfABITy),
>> - CachePtrTy,
>> + llvm::PointerType::getUnqual(ClassnfABITy),
>> CachePtrTy,
>> llvm::PointerType::getUnqual(ImpnfABITy),
>> - llvm::PointerType::getUnqual(ClassRonfABITy),
>> - nullptr);
>> + llvm::PointerType::getUnqual(ClassRonfABITy));
>>
>> // LLVM for struct _class_t *
>> ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);
>> @@ -5854,15 +5821,10 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // const struct _prop_list_t * const class_properties;
>> // const uint32_t size;
>> // }
>> - CategorynfABITy = llvm::StructType::create("struct._category_t",
>> - Int8PtrTy, ClassnfABIPtrTy,
>> - MethodListnfABIPtrTy,
>> - MethodListnfABIPtrTy,
>> - ProtocolListnfABIPtrTy,
>> - PropertyListPtrTy,
>> - PropertyListPtrTy,
>> - IntTy,
>> - nullptr);
>> + CategorynfABITy = llvm::StructType::create(
>> + "struct._category_t", Int8PtrTy, ClassnfABIPtrTy,
>> MethodListnfABIPtrTy,
>> + MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, PropertyListPtrTy,
>> + PropertyListPtrTy, IntTy);
>>
>> // New types for nonfragile abi messaging.
>> CodeGen::CodeGenTypes &Types = CGM.getTypes();
>> @@ -5899,9 +5861,8 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // SUPER_IMP messenger;
>> // SEL name;
>> // };
>> - SuperMessageRefTy =
>> - llvm::StructType::create("struct._super_message_ref_t",
>> - ImpnfABITy, SelectorPtrTy, nullptr);
>> + SuperMessageRefTy =
>> llvm::StructType::create("struct._super_message_ref_t",
>> + ImpnfABITy,
>> SelectorPtrTy);
>>
>> // SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
>> SuperMessageRefPtrTy =
>> llvm::PointerType::getUnqual(SuperMessageRefTy);
>> @@ -5912,10 +5873,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
>> // const char* name; // c++ typeinfo string
>> // Class cls;
>> // };
>> - EHTypeTy =
>> - llvm::StructType::create("struct._objc_typeinfo",
>> - llvm::PointerType::getUnqual(Int8PtrTy),
>> - Int8PtrTy, ClassnfABIPtrTy, nullptr);
>> + EHTypeTy = llvm::StructType::create("struct._objc_typeinfo",
>> +
>> llvm::PointerType::getUnqual(Int8PtrTy),
>> + Int8PtrTy, ClassnfABIPtrTy);
>> EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy);
>> }
>>
>>
>> Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue May 9 14:31:30 2017
>> @@ -728,7 +728,7 @@ CGOpenMPRuntime::CGOpenMPRuntime(CodeGen
>> IdentTy = llvm::StructType::create(
>> "ident_t", CGM.Int32Ty /* reserved_1 */, CGM.Int32Ty /* flags */,
>> CGM.Int32Ty /* reserved_2 */, CGM.Int32Ty /* reserved_3 */,
>> - CGM.Int8PtrTy /* psource */, nullptr);
>> + CGM.Int8PtrTy /* psource */);
>> KmpCriticalNameTy = llvm::ArrayType::get(CGM.Int32Ty,
>> /*NumElements*/ 8);
>>
>> loadOffloadInfoMetadata();
>>
>> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue May 9 14:31:30 2017
>> @@ -751,7 +751,7 @@ void CodeGenModule::EmitCtorList(CtorLis
>>
>> // Get the type of a ctor entry, { i32, void ()*, i8* }.
>> llvm::StructType *CtorStructTy = llvm::StructType::get(
>> - Int32Ty, llvm::PointerType::getUnqual(CtorFTy), VoidPtrTy,
>> nullptr);
>> + Int32Ty, llvm::PointerType::getUnqual(CtorFTy), VoidPtrTy);
>>
>> // Construct the constructor and destructor arrays.
>> ConstantInitBuilder builder(*this);
>>
>> Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Tue May 9 14:31:30 2017
>> @@ -490,7 +490,7 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
>> llvm_unreachable("Unexpected undeduced type!");
>> case Type::Complex: {
>> llvm::Type *EltTy =
>> ConvertType(cast<ComplexType>(Ty)->getElementType());
>> - ResultType = llvm::StructType::get(EltTy, EltTy, nullptr);
>> + ResultType = llvm::StructType::get(EltTy, EltTy);
>> break;
>> }
>> case Type::LValueReference:
>>
>> Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Tue May 9 14:31:30 2017
>> @@ -499,7 +499,7 @@ llvm::Type *
>> ItaniumCXXABI::ConvertMemberPointerType(const MemberPointerType *MPT) {
>> if (MPT->isMemberDataPointer())
>> return CGM.PtrDiffTy;
>> - return llvm::StructType::get(CGM.PtrDiffTy, CGM.PtrDiffTy, nullptr);
>> + return llvm::StructType::get(CGM.PtrDiffTy, CGM.PtrDiffTy);
>> }
>>
>> /// In the Itanium and ARM ABIs, method pointers have the form:
>>
>> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue May 9 14:31:30 2017
>> @@ -3159,8 +3159,7 @@ GetX86_64ByValArgumentPair(llvm::Type *L
>> }
>> }
>>
>> - llvm::StructType *Result = llvm::StructType::get(Lo, Hi, nullptr);
>> -
>> + llvm::StructType *Result = llvm::StructType::get(Lo, Hi);
>>
>> // Verify that the second element is at an 8-byte offset.
>> assert(TD.getStructLayout(Result)->getElementOffset(1) == 8 &&
>> @@ -3235,8 +3234,7 @@ classifyReturnType(QualType RetTy) const
>> case ComplexX87:
>> assert(Hi == ComplexX87 && "Unexpected ComplexX87 classification.");
>> ResType =
>> llvm::StructType::get(llvm::Type::getX86_FP80Ty(getVMContext()),
>> -
>> llvm::Type::getX86_FP80Ty(getVMContext()),
>> - nullptr);
>> +
>> llvm::Type::getX86_FP80Ty(getVMContext()));
>> break;
>> }
>>
>> @@ -3732,7 +3730,7 @@ Address X86_64ABIInfo::EmitVAArg(CodeGen
>> CGF.Builder.CreateConstInBoundsByteGEP(RegAddrLo,
>>
>> CharUnits::fromQuantity(16));
>> llvm::Type *DoubleTy = CGF.DoubleTy;
>> - llvm::StructType *ST = llvm::StructType::get(DoubleTy, DoubleTy,
>> nullptr);
>> + llvm::StructType *ST = llvm::StructType::get(DoubleTy, DoubleTy);
>> llvm::Value *V;
>> Address Tmp = CGF.CreateMemTemp(Ty);
>> Tmp = CGF.Builder.CreateElementBitCast(Tmp, ST);
>> @@ -4637,7 +4635,7 @@ PPC64_SVR4_ABIInfo::classifyReturnType(Q
>> llvm::Type *CoerceTy;
>> if (Bits > GPRBits) {
>> CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits);
>> - CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy, nullptr);
>> + CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy);
>> } else
>> CoerceTy =
>> llvm::IntegerType::get(getVMContext(),
>> llvm::alignTo(Bits, 8));
>>
>> Modified:
>> cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> ---
>> cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
>> (original)
>> +++
>> cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
>> Tue May 9 14:31:30 2017
>> @@ -233,19 +233,16 @@ void NilArgChecker::checkPreObjCMessage(
>> if (StringSelectors.empty()) {
>> ASTContext &Ctx = C.getASTContext();
>> Selector Sels[] = {
>> - getKeywordSelector(Ctx, "caseInsensitiveCompare", nullptr),
>> - getKeywordSelector(Ctx, "compare", nullptr),
>> - getKeywordSelector(Ctx, "compare", "options", nullptr),
>> - getKeywordSelector(Ctx, "compare", "options", "range", nullptr),
>> - getKeywordSelector(Ctx, "compare", "options", "range", "locale",
>> - nullptr),
>> - getKeywordSelector(Ctx, "componentsSeparatedByCharactersInSet",
>> - nullptr),
>> - getKeywordSelector(Ctx, "initWithFormat",
>> - nullptr),
>> - getKeywordSelector(Ctx, "localizedCaseInsensitiveCompare",
>> nullptr),
>> - getKeywordSelector(Ctx, "localizedCompare", nullptr),
>> - getKeywordSelector(Ctx, "localizedStandardCompare", nullptr),
>> + getKeywordSelector(Ctx, "caseInsensitiveCompare"),
>> + getKeywordSelector(Ctx, "compare"),
>> + getKeywordSelector(Ctx, "compare", "options"),
>> + getKeywordSelector(Ctx, "compare", "options", "range"),
>> + getKeywordSelector(Ctx, "compare", "options", "range",
>> "locale"),
>> + getKeywordSelector(Ctx,
>> "componentsSeparatedByCharactersInSet"),
>> + getKeywordSelector(Ctx, "initWithFormat"),
>> + getKeywordSelector(Ctx, "localizedCaseInsensitiveCompare"),
>> + getKeywordSelector(Ctx, "localizedCompare"),
>> + getKeywordSelector(Ctx, "localizedStandardCompare"),
>> };
>> for (Selector KnownSel : Sels)
>> StringSelectors[KnownSel] = 0;
>> @@ -262,16 +259,15 @@ void NilArgChecker::checkPreObjCMessage(
>>
>> if (ArrayWithObjectSel.isNull()) {
>> ASTContext &Ctx = C.getASTContext();
>> - ArrayWithObjectSel = getKeywordSelector(Ctx, "arrayWithObject",
>> nullptr);
>> - AddObjectSel = getKeywordSelector(Ctx, "addObject", nullptr);
>> + ArrayWithObjectSel = getKeywordSelector(Ctx, "arrayWithObject");
>> + AddObjectSel = getKeywordSelector(Ctx, "addObject");
>> InsertObjectAtIndexSel =
>> - getKeywordSelector(Ctx, "insertObject", "atIndex", nullptr);
>> + getKeywordSelector(Ctx, "insertObject", "atIndex");
>> ReplaceObjectAtIndexWithObjectSel =
>> - getKeywordSelector(Ctx, "replaceObjectAtIndex", "withObject",
>> nullptr);
>> + getKeywordSelector(Ctx, "replaceObjectAtIndex", "withObject");
>> SetObjectAtIndexedSubscriptSel =
>> - getKeywordSelector(Ctx, "setObject", "atIndexedSubscript",
>> nullptr);
>> - ArrayByAddingObjectSel =
>> - getKeywordSelector(Ctx, "arrayByAddingObject", nullptr);
>> + getKeywordSelector(Ctx, "setObject", "atIndexedSubscript");
>> + ArrayByAddingObjectSel = getKeywordSelector(Ctx,
>> "arrayByAddingObject");
>> }
>>
>> if (S == ArrayWithObjectSel || S == AddObjectSel ||
>> @@ -292,13 +288,11 @@ void NilArgChecker::checkPreObjCMessage(
>> if (DictionaryWithObjectForKeySel.isNull()) {
>> ASTContext &Ctx = C.getASTContext();
>> DictionaryWithObjectForKeySel =
>> - getKeywordSelector(Ctx, "dictionaryWithObject", "forKey",
>> nullptr);
>> - SetObjectForKeySel =
>> - getKeywordSelector(Ctx, "setObject", "forKey", nullptr);
>> + getKeywordSelector(Ctx, "dictionaryWithObject", "forKey");
>> + SetObjectForKeySel = getKeywordSelector(Ctx, "setObject",
>> "forKey");
>> SetObjectForKeyedSubscriptSel =
>> - getKeywordSelector(Ctx, "setObject", "forKeyedSubscript",
>> nullptr);
>> - RemoveObjectForKeySel =
>> - getKeywordSelector(Ctx, "removeObjectForKey", nullptr);
>> + getKeywordSelector(Ctx, "setObject", "forKeyedSubscript");
>> + RemoveObjectForKeySel = getKeywordSelector(Ctx,
>> "removeObjectForKey");
>> }
>>
>> if (S == DictionaryWithObjectForKeySel || S == SetObjectForKeySel) {
>>
>> Modified:
>> cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> (original)
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> Tue May 9 14:31:30 2017
>> @@ -123,14 +123,14 @@ void NoReturnFunctionChecker::checkPostO
>> case 4:
>> lazyInitKeywordSelector(HandleFailureInFunctionSel,
>> C.getASTContext(),
>> "handleFailureInFunction", "file",
>> "lineNumber",
>> - "description", nullptr);
>> + "description");
>> if (Sel != HandleFailureInFunctionSel)
>> return;
>> break;
>> case 5:
>> lazyInitKeywordSelector(HandleFailureInMethodSel, C.getASTContext(),
>> "handleFailureInMethod", "object", "file",
>> - "lineNumber", "description", nullptr);
>> + "lineNumber", "description");
>> if (Sel != HandleFailureInMethodSel)
>> return;
>> break;
>>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
>> (original)
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Tue
>> May 9 14:31:30 2017
>> @@ -703,31 +703,30 @@ private:
>> ObjCMethodSummaries[ObjCSummaryKey(ClsII, S)] = Summ;
>> }
>>
>> + template <typename... Keywords>
>> void addMethodSummary(IdentifierInfo *ClsII, ObjCMethodSummariesTy
>> &Summaries,
>> - const RetainSummary *Summ, va_list argp) {
>> - Selector S = getKeywordSelector(Ctx, argp);
>> + const RetainSummary *Summ, Keywords *... Kws) {
>> + Selector S = getKeywordSelector(Ctx, Kws...);
>> Summaries[ObjCSummaryKey(ClsII, S)] = Summ;
>> }
>>
>> - void addInstMethSummary(const char* Cls, const RetainSummary *
>> Summ, ...) {
>> - va_list argp;
>> - va_start(argp, Summ);
>> - addMethodSummary(&Ctx.Idents.get(Cls), ObjCMethodSummaries, Summ,
>> argp);
>> - va_end(argp);
>> - }
>> -
>> - void addClsMethSummary(const char* Cls, const RetainSummary * Summ,
>> ...) {
>> - va_list argp;
>> - va_start(argp, Summ);
>> - addMethodSummary(&Ctx.Idents.get(Cls),ObjCClassMethodSummaries,
>> Summ, argp);
>> - va_end(argp);
>> - }
>> -
>> - void addClsMethSummary(IdentifierInfo *II, const RetainSummary *
>> Summ, ...) {
>> - va_list argp;
>> - va_start(argp, Summ);
>> - addMethodSummary(II, ObjCClassMethodSummaries, Summ, argp);
>> - va_end(argp);
>> + template <typename... Keywords>
>> + void addInstMethSummary(const char *Cls, const RetainSummary *Summ,
>> + Keywords *... Kws) {
>> + addMethodSummary(&Ctx.Idents.get(Cls), ObjCMethodSummaries, Summ,
>> Kws...);
>> + }
>> +
>> + template <typename... Keywords>
>> + void addClsMethSummary(const char *Cls, const RetainSummary *Summ,
>> + Keywords *... Kws) {
>> + addMethodSummary(&Ctx.Idents.get(Cls), ObjCClassMethodSummaries,
>> Summ,
>> + Kws...);
>> + }
>> +
>> + template <typename... Keywords>
>> + void addClsMethSummary(IdentifierInfo *II, const RetainSummary *Summ,
>> + Keywords *... Kws) {
>> + addMethodSummary(II, ObjCClassMethodSummaries, Summ, Kws...);
>> }
>>
>> public:
>> @@ -1640,20 +1639,16 @@ void RetainSummaryManager::InitializeMet
>> addClassMethSummary("NSAutoreleasePool", "new", NoTrackYet);
>>
>> // Create summaries QCRenderer/QCView -createSnapShotImageOfType:
>> - addInstMethSummary("QCRenderer", AllocSumm,
>> - "createSnapshotImageOfType", nullptr);
>> - addInstMethSummary("QCView", AllocSumm,
>> - "createSnapshotImageOfType", nullptr);
>> + addInstMethSummary("QCRenderer", AllocSumm,
>> "createSnapshotImageOfType");
>> + addInstMethSummary("QCView", AllocSumm, "createSnapshotImageOfType");
>>
>> // Create summaries for CIContext, 'createCGImage' and
>> // 'createCGLayerWithSize'. These objects are CF objects, and are not
>> // automatically garbage collected.
>> - addInstMethSummary("CIContext", CFAllocSumm,
>> - "createCGImage", "fromRect", nullptr);
>> + addInstMethSummary("CIContext", CFAllocSumm, "createCGImage",
>> "fromRect");
>> addInstMethSummary("CIContext", CFAllocSumm, "createCGImage",
>> "fromRect",
>> - "format", "colorSpace", nullptr);
>> - addInstMethSummary("CIContext", CFAllocSumm,
>> "createCGLayerWithSize", "info",
>> - nullptr);
>> + "format", "colorSpace");
>> + addInstMethSummary("CIContext", CFAllocSumm,
>> "createCGLayerWithSize", "info");
>> }
>>
>> //===----------------------------------------------------------------------===//
>>
>>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/SelectorExtras.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/SelectorExtras.h?rev=302572&r1=302571&r2=302572&view=diff
>>
>> ==============================================================================
>>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/SelectorExtras.h (original)
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/SelectorExtras.h Tue May 9
>> 14:31:30 2017
>> @@ -11,48 +11,26 @@
>> #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SELECTOREXTRAS_H
>>
>> #include "clang/AST/ASTContext.h"
>> -#include <cstdarg>
>>
>> namespace clang {
>> namespace ento {
>>
>> -static inline Selector getKeywordSelectorImpl(ASTContext &Ctx,
>> - const char *First,
>> - va_list argp) {
>> - SmallVector<IdentifierInfo*, 10> II;
>> - II.push_back(&Ctx.Idents.get(First));
>> -
>> - while (const char *s = va_arg(argp, const char *))
>> - II.push_back(&Ctx.Idents.get(s));
>> +template <typename... IdentifierInfos>
>> +static inline Selector getKeywordSelector(ASTContext &Ctx,
>> + IdentifierInfos *... IIs) {
>> + static_assert(sizeof...(IdentifierInfos),
>> + "keyword selectors must have at least one argument");
>> + SmallVector<IdentifierInfo *, 10> II{{&Ctx.Idents.get(IIs)...}};
>>
>> return Ctx.Selectors.getSelector(II.size(), &II[0]);
>> }
>>
>> -static inline Selector getKeywordSelector(ASTContext &Ctx, va_list
>> argp) {
>> - const char *First = va_arg(argp, const char *);
>> - assert(First && "keyword selectors must have at least one argument");
>> - return getKeywordSelectorImpl(Ctx, First, argp);
>> -}
>> -
>> -LLVM_END_WITH_NULL
>> -static inline Selector getKeywordSelector(ASTContext &Ctx,
>> - const char *First, ...) {
>> - va_list argp;
>> - va_start(argp, First);
>> - Selector result = getKeywordSelectorImpl(Ctx, First, argp);
>> - va_end(argp);
>> - return result;
>> -}
>> -
>> -LLVM_END_WITH_NULL
>> +template <typename... IdentifierInfos>
>> static inline void lazyInitKeywordSelector(Selector &Sel, ASTContext
>> &Ctx,
>> - const char *First, ...) {
>> + IdentifierInfos *... IIs) {
>> if (!Sel.isNull())
>> return;
>> - va_list argp;
>> - va_start(argp, First);
>> - Sel = getKeywordSelectorImpl(Ctx, First, argp);
>> - va_end(argp);
>> + Sel = getKeywordSelector(Ctx, IIs...);
>> }
>>
>> static inline void lazyInitNullarySelector(Selector &Sel, ASTContext
>> &Ctx,
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list