diff options
Diffstat (limited to 'clang/lib')
42 files changed, 383 insertions, 376 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 143b6078a22d..6988b8d62623 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2088,7 +2088,7 @@ const FunctionType *ASTContext::adjustFunctionType(const FunctionType *T, const FunctionProtoType *FPT = cast<FunctionProtoType>(T); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExtInfo = Info; - Result = getFunctionType(FPT->getResultType(), FPT->getArgTypes(), EPI); + Result = getFunctionType(FPT->getResultType(), FPT->getParamTypes(), EPI); } return cast<FunctionType>(Result.getTypePtr()); @@ -2100,7 +2100,7 @@ void ASTContext::adjustDeducedFunctionResultType(FunctionDecl *FD, while (true) { const FunctionProtoType *FPT = FD->getType()->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); - FD->setType(getFunctionType(ResultType, FPT->getArgTypes(), EPI)); + FD->setType(getFunctionType(ResultType, FPT->getParamTypes(), EPI)); if (FunctionDecl *Next = FD->getPreviousDecl()) FD = Next; else @@ -5423,8 +5423,9 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, S += "@?"; // Block parameters if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) { - for (FunctionProtoType::arg_type_iterator I = FPT->arg_type_begin(), - E = FPT->arg_type_end(); I && (I != E); ++I) { + for (FunctionProtoType::param_type_iterator I = FPT->param_type_begin(), + E = FPT->param_type_end(); + I && (I != E); ++I) { getObjCEncodingForTypeImpl(*I, S, ExpandPointedToStructures, ExpandStructures, @@ -6855,11 +6856,11 @@ QualType ASTContext::mergeTransparentUnionType(QualType T, QualType SubType, return QualType(); } -/// mergeFunctionArgumentTypes - merge two types which appear as function -/// argument types -QualType ASTContext::mergeFunctionArgumentTypes(QualType lhs, QualType rhs, - bool OfBlockPointer, - bool Unqualified) { +/// mergeFunctionParameterTypes - merge two types which appear as function +/// parameter types +QualType ASTContext::mergeFunctionParameterTypes(QualType lhs, QualType rhs, + bool OfBlockPointer, + bool Unqualified) { // GNU extension: two types are compatible if they appear as a function // argument, one of the types is a transparent union type and the other // type is compatible with a union member @@ -6949,8 +6950,8 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, if (lproto && rproto) { // two C99 style function prototypes assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() && "C++ shouldn't be here"); - unsigned lproto_nargs = lproto->getNumArgs(); - unsigned rproto_nargs = rproto->getNumArgs(); + unsigned lproto_nargs = lproto->getNumParams(); + unsigned rproto_nargs = rproto->getNumParams(); // Compatible functions must have the same number of arguments if (lproto_nargs != rproto_nargs) @@ -6970,11 +6971,10 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, // Check argument compatibility SmallVector<QualType, 10> types; for (unsigned i = 0; i < lproto_nargs; i++) { - QualType largtype = lproto->getArgType(i).getUnqualifiedType(); - QualType rargtype = rproto->getArgType(i).getUnqualifiedType(); - QualType argtype = mergeFunctionArgumentTypes(largtype, rargtype, - OfBlockPointer, - Unqualified); + QualType largtype = lproto->getParamType(i).getUnqualifiedType(); + QualType rargtype = rproto->getParamType(i).getUnqualifiedType(); + QualType argtype = mergeFunctionParameterTypes( + largtype, rargtype, OfBlockPointer, Unqualified); if (argtype.isNull()) return QualType(); if (Unqualified) @@ -7012,10 +7012,10 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, // The only types actually affected are promotable integer // types and floats, which would be passed as a different // type depending on whether the prototype is visible. - unsigned proto_nargs = proto->getNumArgs(); + unsigned proto_nargs = proto->getNumParams(); for (unsigned i = 0; i < proto_nargs; ++i) { - QualType argTy = proto->getArgType(i); - + QualType argTy = proto->getParamType(i); + // Look at the converted type of enum types, since that is the type used // to pass enum values. if (const EnumType *Enum = argTy->getAs<EnumType>()) { @@ -7034,7 +7034,7 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, FunctionProtoType::ExtProtoInfo EPI = proto->getExtProtoInfo(); EPI.ExtInfo = einfo; - return getFunctionType(retType, proto->getArgTypes(), EPI); + return getFunctionType(retType, proto->getParamTypes(), EPI); } if (allLTypes) return lhs; @@ -7338,16 +7338,16 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS, bool ASTContext::FunctionTypesMatchOnNSConsumedAttrs( const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType) { - if (FromFunctionType->hasAnyConsumedArgs() != - ToFunctionType->hasAnyConsumedArgs()) + if (FromFunctionType->hasAnyConsumedParams() != + ToFunctionType->hasAnyConsumedParams()) return false; FunctionProtoType::ExtProtoInfo FromEPI = FromFunctionType->getExtProtoInfo(); FunctionProtoType::ExtProtoInfo ToEPI = ToFunctionType->getExtProtoInfo(); if (FromEPI.ConsumedArguments && ToEPI.ConsumedArguments) - for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs(); - ArgIdx != NumArgs; ++ArgIdx) { + for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams(); + ArgIdx != NumArgs; ++ArgIdx) { if (FromEPI.ConsumedArguments[ArgIdx] != ToEPI.ConsumedArguments[ArgIdx]) return false; @@ -7383,7 +7383,7 @@ QualType ASTContext::mergeObjCGCQualifiers(QualType LHS, QualType RHS) { FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExtInfo = getFunctionExtInfo(LHS); QualType ResultType = - getFunctionType(OldReturnType, FPT->getArgTypes(), EPI); + getFunctionType(OldReturnType, FPT->getParamTypes(), EPI); return ResultType; } } diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index d1a606f853a4..ec6f22609ad5 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -535,12 +535,11 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, case Type::FunctionProto: { const FunctionProtoType *Proto1 = cast<FunctionProtoType>(T1); const FunctionProtoType *Proto2 = cast<FunctionProtoType>(T2); - if (Proto1->getNumArgs() != Proto2->getNumArgs()) + if (Proto1->getNumParams() != Proto2->getNumParams()) return false; - for (unsigned I = 0, N = Proto1->getNumArgs(); I != N; ++I) { - if (!IsStructurallyEquivalent(Context, - Proto1->getArgType(I), - Proto2->getArgType(I))) + for (unsigned I = 0, N = Proto1->getNumParams(); I != N; ++I) { + if (!IsStructurallyEquivalent(Context, Proto1->getParamType(I), + Proto2->getParamType(I))) return false; } if (Proto1->isVariadic() != Proto2->isVariadic()) @@ -1602,8 +1601,8 @@ QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) { // Import argument types SmallVector<QualType, 4> ArgTypes; - for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(), - AEnd = T->arg_type_end(); + for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), + AEnd = T->param_type_end(); A != AEnd; ++A) { QualType ArgType = Importer.Import(*A); if (ArgType.isNull()) @@ -2718,7 +2717,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { FromEPI.NoexceptExpr) { FunctionProtoType::ExtProtoInfo DefaultEPI; FromTy = Importer.getFromContext().getFunctionType( - FromFPT->getResultType(), FromFPT->getArgTypes(), DefaultEPI); + FromFPT->getResultType(), FromFPT->getParamTypes(), DefaultEPI); usedDifferentExceptionSpec = true; } } diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 7a1cd71c2628..4d864f2128cf 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2308,7 +2308,8 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { return false; const FunctionProtoType *proto = getType()->castAs<FunctionProtoType>(); - if (proto->getNumArgs() != 2 || proto->isVariadic()) return false; + if (proto->getNumParams() != 2 || proto->isVariadic()) + return false; ASTContext &Context = cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext()) @@ -2316,7 +2317,7 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const { // The result type and first argument type are constant across all // these operators. The second argument must be exactly void*. - return (proto->getArgType(1).getCanonicalType() == Context.VoidPtrTy); + return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy); } static bool isNamespaceStd(const DeclContext *DC) { @@ -2342,17 +2343,17 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction() const { return false; const FunctionProtoType *FPT = getType()->castAs<FunctionProtoType>(); - if (FPT->getNumArgs() > 2 || FPT->isVariadic()) + if (FPT->getNumParams() > 2 || FPT->isVariadic()) return false; // If this is a single-parameter function, it must be a replaceable global // allocation or deallocation function. - if (FPT->getNumArgs() == 1) + if (FPT->getNumParams() == 1) return true; // Otherwise, we're looking for a second parameter whose type is // 'const std::nothrow_t &', or, in C++1y, 'std::size_t'. - QualType Ty = FPT->getArgType(1); + QualType Ty = FPT->getParamType(1); ASTContext &Ctx = getASTContext(); if (Ctx.getLangOpts().SizedDeallocation && Ctx.hasSameType(Ty, Ctx.getSizeType())) @@ -2385,7 +2386,7 @@ FunctionDecl::getCorrespondingUnsizedGlobalDeallocationFunction() const { return 0; if (getNumParams() != 2 || isVariadic() || - !Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getArgType(1), + !Ctx.hasSameType(getType()->castAs<FunctionProtoType>()->getParamType(1), Ctx.getSizeType())) return 0; @@ -2517,7 +2518,7 @@ unsigned FunctionDecl::getBuiltinID() const { /// after it has been created. unsigned FunctionDecl::getNumParams() const { const FunctionProtoType *FPT = getType()->getAs<FunctionProtoType>(); - return FPT ? FPT->getNumArgs() : 0; + return FPT ? FPT->getNumParams() : 0; } void FunctionDecl::setParams(ASTContext &C, diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 429b235315dc..e1e56df2f277 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -868,7 +868,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { if (noParams < 1 || noParams > 3) family = OMF_None; else { - ObjCMethodDecl::arg_type_iterator it = arg_type_begin(); + ObjCMethodDecl::param_type_iterator it = arg_type_begin(); QualType ArgT = (*it); if (!ArgT->isObjCSelType()) { family = OMF_None; diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index fd6bb0bd432e..99f419790ce1 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2017,7 +2017,7 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T, FunctionTypeDepth.leaveResultType(); } - if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) { + if (Proto->getNumParams() == 0 && !Proto->isVariadic()) { // <builtin-type> ::= v # void Out << 'v'; @@ -2025,8 +2025,8 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T, return; } - for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(), - ArgEnd = Proto->arg_type_end(); + for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(), + ArgEnd = Proto->param_type_end(); Arg != ArgEnd; ++Arg) mangleType(Context.getASTContext().getSignatureParameterType(*Arg)); diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp index ab2434415b40..6ab2406079b9 100644 --- a/clang/lib/AST/Mangle.cpp +++ b/clang/lib/AST/Mangle.cpp @@ -163,8 +163,8 @@ void MangleContext::mangleName(const NamedDecl *D, raw_ostream &Out) { if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) if (!MD->isStatic()) ++ArgWords; - for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(), - ArgEnd = Proto->arg_type_end(); + for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(), + ArgEnd = Proto->param_type_end(); Arg != ArgEnd; ++Arg) { QualType AT = *Arg; // Size should be aligned to DWORD boundary diff --git a/clang/lib/AST/MangleNumberingContext.cpp b/clang/lib/AST/MangleNumberingContext.cpp index 91ef0e2240d8..ec503e01932b 100644 --- a/clang/lib/AST/MangleNumberingContext.cpp +++ b/clang/lib/AST/MangleNumberingContext.cpp @@ -24,7 +24,7 @@ MangleNumberingContext::getManglingNumber(const CXXMethodDecl *CallOperator) { = CallOperator->getType()->getAs<FunctionProtoType>(); ASTContext &Context = CallOperator->getASTContext(); - QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(), + QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), FunctionProtoType::ExtProtoInfo()); Key = Context.getCanonicalType(Key); return ++ManglingNumbers[Key->castAs<FunctionProtoType>()]; diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 4527efa1ef42..30c53ed0ef1b 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1336,12 +1336,13 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T, // <argument-list> ::= X # void // ::= <type>+ @ // ::= <type>* Z # varargs - if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) { + if (Proto->getNumParams() == 0 && !Proto->isVariadic()) { Out << 'X'; } else { // Happens for function pointer type arguments for example. - for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(), - ArgEnd = Proto->arg_type_end(); + for (FunctionProtoType::param_type_iterator + Arg = Proto->param_type_begin(), + ArgEnd = Proto->param_type_end(); Arg != ArgEnd; ++Arg) mangleArgumentType(*Arg, Range); // <builtin-type> ::= Z # ellipsis diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 3d4a7454f77f..caa7a4ad181b 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1659,7 +1659,7 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args, } if (epi.ConsumedArguments) { - bool *consumedArgs = const_cast<bool*>(getConsumedArgsBuffer()); + bool *consumedArgs = const_cast<bool *>(getConsumedParamsBuffer()); for (unsigned i = 0; i != NumArgs; ++i) consumedArgs[i] = epi.ConsumedArguments[i]; } @@ -1715,8 +1715,8 @@ bool FunctionProtoType::isNothrow(const ASTContext &Ctx, } bool FunctionProtoType::isTemplateVariadic() const { - for (unsigned ArgIdx = getNumArgs(); ArgIdx; --ArgIdx) - if (isa<PackExpansionType>(getArgType(ArgIdx - 1))) + for (unsigned ArgIdx = getNumParams(); ArgIdx; --ArgIdx) + if (isa<PackExpansionType>(getParamType(ArgIdx - 1))) return true; return false; @@ -1778,7 +1778,7 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) { - Profile(ID, getResultType(), arg_type_begin(), NumArgs, getExtProtoInfo(), + Profile(ID, getResultType(), param_type_begin(), NumArgs, getExtProtoInfo(), Ctx); } @@ -2232,8 +2232,9 @@ static CachedProperties computeCachedProperties(const Type *T) { case Type::FunctionProto: { const FunctionProtoType *FPT = cast<FunctionProtoType>(T); CachedProperties result = Cache::get(FPT->getResultType()); - for (FunctionProtoType::arg_type_iterator ai = FPT->arg_type_begin(), - ae = FPT->arg_type_end(); ai != ae; ++ai) + for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(), + ae = FPT->param_type_end(); + ai != ae; ++ai) result = merge(result, Cache::get(*ai)); return result; } @@ -2317,8 +2318,9 @@ static LinkageInfo computeLinkageInfo(const Type *T) { case Type::FunctionProto: { const FunctionProtoType *FPT = cast<FunctionProtoType>(T); LinkageInfo LV = computeLinkageInfo(FPT->getResultType()); - for (FunctionProtoType::arg_type_iterator ai = FPT->arg_type_begin(), - ae = FPT->arg_type_end(); ai != ae; ++ai) + for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(), + ae = FPT->param_type_end(); + ai != ae; ++ai) LV.merge(computeLinkageInfo(*ai)); return LV; } diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 45fc9c4a1819..9f7cf5196ad1 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -624,17 +624,17 @@ void TypePrinter::printFunctionProtoAfter(const FunctionProtoType *T, OS << '('; { ParamPolicyRAII ParamPolicy(Policy); - for (unsigned i = 0, e = T->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = T->getNumParams(); i != e; ++i) { if (i) OS << ", "; - print(T->getArgType(i), OS, StringRef()); + print(T->getParamType(i), OS, StringRef()); } } if (T->isVariadic()) { - if (T->getNumArgs()) + if (T->getNumParams()) OS << ", "; OS << "..."; - } else if (T->getNumArgs() == 0 && !Policy.LangOpts.CPlusPlus) { + } else if (T->getNumParams() == 0 && !Policy.LangOpts.CPlusPlus) { // Do not emit int() if we have a proto, emit 'int(void)'. OS << "void"; } diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 354e8e0d2e0a..af4986e27ece 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -479,10 +479,10 @@ static bool HasSameVirtualSignature(const CXXMethodDecl *LHS, // list here because there isn't necessarily an inheritance // relationship between the two methods. if (LT->getTypeQuals() != RT->getTypeQuals() || - LT->getNumArgs() != RT->getNumArgs()) + LT->getNumParams() != RT->getNumParams()) return false; - for (unsigned I = 0, E = LT->getNumArgs(); I != E; ++I) - if (LT->getArgType(I) != RT->getArgType(I)) + for (unsigned I = 0, E = LT->getNumParams(); I != E; ++I) + if (LT->getParamType(I) != RT->getParamType(I)) return false; return true; } diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp index 373f5d1ffa71..6ec63c72217e 100644 --- a/clang/lib/Analysis/BodyFarm.cpp +++ b/clang/lib/Analysis/BodyFarm.cpp @@ -35,8 +35,7 @@ static bool isDispatchBlock(QualType Ty) { // returns void. const FunctionProtoType *FT = BPT->getPointeeType()->getAs<FunctionProtoType>(); - if (!FT || !FT->getResultType()->isVoidType() || - FT->getNumArgs() != 0) + if (!FT || !FT->getResultType()->isVoidType() || FT->getNumParams() != 0) return false; return true; diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d31217744635..78e22633068d 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -92,8 +92,8 @@ static const CGFunctionInfo &arrangeLLVMFunctionInfo(CodeGenTypes &CGT, FunctionType::ExtInfo extInfo) { RequiredArgs required = RequiredArgs::forPrototypePlus(FTP, prefix.size()); // FIXME: Kill copy. - for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) - prefix.push_back(FTP->getArgType(i)); + for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i) + prefix.push_back(FTP->getParamType(i)); CanQualType resultType = FTP->getResultType().getUnqualifiedType(); return CGT.arrangeLLVMFunctionInfo(resultType, prefix, extInfo, required); } @@ -211,8 +211,8 @@ CodeGenTypes::arrangeCXXConstructorDeclaration(const CXXConstructorDecl *D, CanQual<FunctionProtoType> FTP = GetFormalType(D); // Add the formal parameters. - for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) - argTypes.push_back(FTP->getArgType(i)); + for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i) + argTypes.push_back(FTP->getParamType(i)); TheCXXABI.BuildConstructorSignature(D, ctorKind, resultType, argTypes); @@ -239,7 +239,7 @@ CodeGenTypes::arrangeCXXDestructor(const CXXDestructorDecl *D, TheCXXABI.BuildDestructorSignature(D, dtorKind, resultType, argTypes); CanQual<FunctionProtoType> FTP = GetFormalType(D); - assert(FTP->getNumArgs() == 0 && "dtor with formal parameters"); + assert(FTP->getNumParams() == 0 && "dtor with formal parameters"); assert(FTP->isVariadic() == 0 && "dtor with formal parameters"); FunctionType::ExtInfo extInfo = FTP->getExtInfo(); @@ -344,7 +344,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT, // extra prefix plus the arguments in the prototype. if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fnType)) { if (proto->isVariadic()) - required = RequiredArgs(proto->getNumArgs() + numExtraRequiredArgs); + required = RequiredArgs(proto->getNumParams() + numExtraRequiredArgs); // If we don't have a prototype at all, but we're supposed to // explicitly use the variadic convention for unprototyped calls, diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 8143fb9ca5d8..d3a1f391f772 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1738,14 +1738,14 @@ CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D, Args.add(RValue::get(This), D->getThisType(getContext())); // Push the src ptr. - QualType QT = *(FPT->arg_type_begin()); + QualType QT = *(FPT->param_type_begin()); llvm::Type *t = CGM.getTypes().ConvertType(QT); Src = Builder.CreateBitCast(Src, t); Args.add(RValue::get(Src), QT); // Skip over first argument (Src). - EmitCallArgs(Args, FPT->isVariadic(), FPT->arg_type_begin() + 1, - FPT->arg_type_end(), ArgBeg + 1, ArgEnd); + EmitCallArgs(Args, FPT->isVariadic(), FPT->param_type_begin() + 1, + FPT->param_type_end(), ArgBeg + 1, ArgEnd); EmitCall(CGM.getTypes().arrangeCXXMethodCall(Args, FPT, RequiredArgs::All), Callee, ReturnValueSlot(), Args, D); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 3edffa565661..faf6fbba1a45 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -761,8 +761,8 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, if (isa<FunctionNoProtoType>(Ty)) EltTys.push_back(DBuilder.createUnspecifiedParameter()); else if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(Ty)) { - for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i) - EltTys.push_back(getOrCreateType(FPT->getArgType(i), Unit)); + for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i) + EltTys.push_back(getOrCreateType(FPT->getParamType(i), Unit)); } llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys); diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 69aecfdc09a6..12b953b33343 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1014,17 +1014,17 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *FPT = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(FPT->getNumArgs() == NumPlacementArgs + 1 || - (FPT->getNumArgs() == 2 && NumPlacementArgs == 0)); + assert(FPT->getNumParams() == NumPlacementArgs + 1 || + (FPT->getNumParams() == 2 && NumPlacementArgs == 0)); CallArgList DeleteArgs; // The first argument is always a void*. - FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin(); + FunctionProtoType::param_type_iterator AI = FPT->param_type_begin(); DeleteArgs.add(RValue::get(Ptr), *AI++); // A member 'operator delete' can take an extra 'size_t' argument. - if (FPT->getNumArgs() == NumPlacementArgs + 2) + if (FPT->getNumParams() == NumPlacementArgs + 2) DeleteArgs.add(RValue::get(AllocSize), *AI++); // Pass the rest of the arguments, which must match exactly. @@ -1069,17 +1069,17 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *FPT = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(FPT->getNumArgs() == NumPlacementArgs + 1 || - (FPT->getNumArgs() == 2 && NumPlacementArgs == 0)); + assert(FPT->getNumParams() == NumPlacementArgs + 1 || + (FPT->getNumParams() == 2 && NumPlacementArgs == 0)); CallArgList DeleteArgs; // The first argument is always a void*. - FunctionProtoType::arg_type_iterator AI = FPT->arg_type_begin(); + FunctionProtoType::param_type_iterator AI = FPT->param_type_begin(); DeleteArgs.add(Ptr.restore(CGF), *AI++); // A member 'operator delete' can take an extra 'size_t' argument. - if (FPT->getNumArgs() == NumPlacementArgs + 2) { + if (FPT->getNumParams() == NumPlacementArgs + 2) { RValue RV = AllocSize.restore(CGF); DeleteArgs.add(RV, *AI++); } @@ -1168,8 +1168,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { // We start at 1 here because the first argument (the allocation size) // has already been emitted. EmitCallArgs(allocatorArgs, allocatorType->isVariadic(), - allocatorType->arg_type_begin() + 1, - allocatorType->arg_type_end(), E->placement_arg_begin(), + allocatorType->param_type_begin() + 1, + allocatorType->param_type_end(), E->placement_arg_begin(), E->placement_arg_end()); // Emit the allocation call. If the allocator is a global placement @@ -1286,14 +1286,14 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD, // Check if we need to pass the size to the delete operator. llvm::Value *Size = 0; QualType SizeTy; - if (DeleteFTy->getNumArgs() == 2) { - SizeTy = DeleteFTy->getArgType(1); + if (DeleteFTy->getNumParams() == 2) { + SizeTy = DeleteFTy->getParamType(1); CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy); Size = llvm::ConstantInt::get(ConvertType(SizeTy), DeleteTypeSize.getQuantity()); } - - QualType ArgTy = DeleteFTy->getArgType(0); + + QualType ArgTy = DeleteFTy->getParamType(0); llvm::Value *DeletePtr = Builder.CreateBitCast(Ptr, ConvertType(ArgTy)); DeleteArgs.add(RValue::get(DeletePtr), ArgTy); @@ -1422,19 +1422,19 @@ namespace { void Emit(CodeGenFunction &CGF, Flags flags) { const FunctionProtoType *DeleteFTy = OperatorDelete->getType()->getAs<FunctionProtoType>(); - assert(DeleteFTy->getNumArgs() == 1 || DeleteFTy->getNumArgs() == 2); + assert(DeleteFTy->getNumParams() == 1 || DeleteFTy->getNumParams() == 2); CallArgList Args; // Pass the pointer as the first argument. - QualType VoidPtrTy = DeleteFTy->getArgType(0); + QualType VoidPtrTy = DeleteFTy->getParamType(0); llvm::Value *DeletePtr = CGF.Builder.CreateBitCast(Ptr, CGF.ConvertType(VoidPtrTy)); Args.add(RValue::get(DeletePtr), VoidPtrTy); // Pass the original requested size as the second argument. - if (DeleteFTy->getNumArgs() == 2) { - QualType size_t = DeleteFTy->getArgType(1); + if (DeleteFTy->getNumParams() == 2) { + QualType size_t = DeleteFTy->getParamType(1); llvm::IntegerType *SizeTy = cast<llvm::IntegerType>(CGF.ConvertType(size_t)); diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 22bb6c3e193f..092eddc7a64e 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2516,11 +2516,11 @@ public: bool ForceColumnInfo = false) { if (CallArgTypeInfo) { EmitCallArgs(Args, CallArgTypeInfo->isVariadic(), - CallArgTypeInfo->arg_type_begin(), - CallArgTypeInfo->arg_type_end(), ArgBeg, ArgEnd, + CallArgTypeInfo->param_type_begin(), + CallArgTypeInfo->param_type_end(), ArgBeg, ArgEnd, ForceColumnInfo); } else { - // T::arg_type_iterator might not have a default ctor. + // T::param_type_iterator might not have a default ctor. const QualType *NoIter = 0; EmitCallArgs(Args, /*AllowExtraArguments=*/true, NoIter, NoIter, ArgBeg, ArgEnd, ForceColumnInfo); diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 5f3c59c197a6..921f02f8d7c5 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -226,8 +226,8 @@ bool CodeGenTypes::isFuncTypeConvertible(const FunctionType *FT) { return false; if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) - for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++) - if (!isFuncTypeArgumentConvertible(FPT->getArgType(i))) + for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++) + if (!isFuncTypeArgumentConvertible(FPT->getParamType(i))) return false; return true; @@ -482,8 +482,8 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { if (const RecordType *RT = FT->getResultType()->getAs<RecordType>()) ConvertRecordDeclType(RT->getDecl()); if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) - for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++) - if (const RecordType *RT = FPT->getArgType(i)->getAs<RecordType>()) + for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++) + if (const RecordType *RT = FPT->getParamType(i)->getAs<RecordType>()) ConvertRecordDeclType(RT->getDecl()); // Return a placeholder type. diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index 16d89f8944a7..6bc0dab757ae 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -628,8 +628,9 @@ void USRGenerator::VisitType(QualType T) { if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) { Out << 'F'; VisitType(FT->getResultType()); - for (FunctionProtoType::arg_type_iterator - I = FT->arg_type_begin(), E = FT->arg_type_end(); I!=E; ++I) { + for (FunctionProtoType::param_type_iterator I = FT->param_type_begin(), + E = FT->param_type_end(); + I != E; ++I) { VisitType(*I); } if (FT->isVariadic()) diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 6ec37f804873..759e57e32b58 100644 --- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -615,8 +615,9 @@ void RewriteModernObjC::RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D) { if (const FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) { - for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(), - E = fproto->arg_type_end(); I && (I != E); ++I) + for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(), + E = fproto->param_type_end(); + I && (I != E); ++I) if (isTopLevelBlockPointerType(*I)) { // All the args are checked/rewritten. Don't call twice! RewriteBlockPointerDecl(D); @@ -984,14 +985,15 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // Now, emit the argument types (if any). if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){ Getr += "("; - for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { if (i) Getr += ", "; - std::string ParamStr = FT->getArgType(i).getAsString( - Context->getPrintingPolicy()); + std::string ParamStr = + FT->getParamType(i).getAsString(Context->getPrintingPolicy()); Getr += ParamStr; } if (FT->isVariadic()) { - if (FT->getNumArgs()) Getr += ", "; + if (FT->getNumParams()) + Getr += ", "; Getr += "..."; } Getr += ")"; @@ -1353,14 +1355,15 @@ void RewriteModernObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl, // Now, emit the argument types (if any). if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) { ResultStr += "("; - for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { if (i) ResultStr += ", "; - std::string ParamStr = FT->getArgType(i).getAsString( - Context->getPrintingPolicy()); + std::string ParamStr = + FT->getParamType(i).getAsString(Context->getPrintingPolicy()); ResultStr += ParamStr; } if (FT->isVariadic()) { - if (FT->getNumArgs()) ResultStr += ", "; + if (FT->getNumParams()) + ResultStr += ", "; ResultStr += "..."; } ResultStr += ")"; @@ -2304,8 +2307,8 @@ void RewriteModernObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { // Now check arguments. const char *startBuf = SM->getCharacterData(Loc); const char *startFuncBuf = startBuf; - for (unsigned i = 0; i < proto->getNumArgs(); i++) { - if (needToScanForQualifiers(proto->getArgType(i))) { + for (unsigned i = 0; i < proto->getNumParams(); i++) { + if (needToScanForQualifiers(proto->getParamType(i))) { // Since types are unique, we need to scan the buffer. const char *endBuf = startBuf; @@ -2448,9 +2451,9 @@ void RewriteModernObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { FdStr += " "; FdStr += FD->getName(); FdStr += "("; - unsigned numArgs = proto->getNumArgs(); + unsigned numArgs = proto->getNumParams(); for (unsigned i = 0; i < numArgs; i++) { - QualType ArgType = proto->getArgType(i); + QualType ArgType = proto->getParamType(i); RewriteBlockPointerType(FdStr, ArgType); if (i+1 < numArgs) FdStr += ", "; @@ -4732,8 +4735,9 @@ QualType RewriteModernObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) bool modified = convertObjCTypeToCStyleType(Res); if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I && (I != E); ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I && (I != E); ++I) { QualType t = *I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (convertObjCTypeToCStyleType(t)) @@ -4800,8 +4804,9 @@ Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp // Push the block argument type. ArgTypes.push_back(PtrBlock); if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I && (I != E); ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I && (I != E); ++I) { QualType t = *I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (!convertBlockPointerToFunctionPointer(t)) @@ -5020,8 +5025,9 @@ bool RewriteModernObjC::PointerTypeTakesAnyBlockArguments(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I != E; ++I) + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I != E; ++I) if (isTopLevelBlockPointerType(*I)) return true; } @@ -5039,8 +5045,9 @@ bool RewriteModernObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I != E; ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I != E; ++I) { if ((*I)->isObjCQualifiedIdType()) return true; if ((*I)->isObjCObjectPointerType() && diff --git a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp index b61096972858..48649574c038 100644 --- a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp +++ b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp @@ -547,8 +547,9 @@ void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D) { if (const FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) { - for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(), - E = fproto->arg_type_end(); I && (I != E); ++I) + for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(), + E = fproto->param_type_end(); + I && (I != E); ++I) if (isTopLevelBlockPointerType(*I)) { // All the args are checked/rewritten. Don't call twice! RewriteBlockPointerDecl(D); @@ -818,14 +819,15 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // Now, emit the argument types (if any). if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){ Getr += "("; - for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { if (i) Getr += ", "; - std::string ParamStr = FT->getArgType(i).getAsString( - Context->getPrintingPolicy()); + std::string ParamStr = + FT->getParamType(i).getAsString(Context->getPrintingPolicy()); Getr += ParamStr; } if (FT->isVariadic()) { - if (FT->getNumArgs()) Getr += ", "; + if (FT->getNumParams()) + Getr += ", "; Getr += "..."; } Getr += ")"; @@ -1157,14 +1159,15 @@ void RewriteObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl, // Now, emit the argument types (if any). if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)) { ResultStr += "("; - for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { if (i) ResultStr += ", "; - std::string ParamStr = FT->getArgType(i).getAsString( - Context->getPrintingPolicy()); + std::string ParamStr = + FT->getParamType(i).getAsString(Context->getPrintingPolicy()); ResultStr += ParamStr; } if (FT->isVariadic()) { - if (FT->getNumArgs()) ResultStr += ", "; + if (FT->getNumParams()) + ResultStr += ", "; ResultStr += "..."; } ResultStr += ")"; @@ -2190,8 +2193,8 @@ void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { // Now check arguments. const char *startBuf = SM->getCharacterData(Loc); const char *startFuncBuf = startBuf; - for (unsigned i = 0; i < proto->getNumArgs(); i++) { - if (needToScanForQualifiers(proto->getArgType(i))) { + for (unsigned i = 0; i < proto->getNumParams(); i++) { + if (needToScanForQualifiers(proto->getParamType(i))) { // Since types are unique, we need to scan the buffer. const char *endBuf = startBuf; @@ -2335,9 +2338,9 @@ void RewriteObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { FdStr += " "; FdStr += FD->getName(); FdStr += "("; - unsigned numArgs = proto->getNumArgs(); + unsigned numArgs = proto->getNumParams(); for (unsigned i = 0; i < numArgs; i++) { - QualType ArgType = proto->getArgType(i); + QualType ArgType = proto->getParamType(i); RewriteBlockPointerType(FdStr, ArgType); if (i+1 < numArgs) FdStr += ", "; @@ -3788,8 +3791,9 @@ QualType RewriteObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) { bool HasBlockType = convertBlockPointerToFunctionPointer(Res); if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I && (I != E); ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I && (I != E); ++I) { QualType t = *I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (convertBlockPointerToFunctionPointer(t)) @@ -3858,8 +3862,9 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { // Push the block argument type. ArgTypes.push_back(PtrBlock); if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I && (I != E); ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I && (I != E); ++I) { QualType t = *I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (!convertBlockPointerToFunctionPointer(t)) @@ -4061,8 +4066,9 @@ bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I != E; ++I) + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I != E; ++I) if (isTopLevelBlockPointerType(*I)) return true; } @@ -4080,8 +4086,9 @@ bool RewriteObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), - E = FTP->arg_type_end(); I != E; ++I) { + for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), + E = FTP->param_type_end(); + I != E; ++I) { if ((*I)->isObjCQualifiedIdType()) return true; if ((*I)->isObjCObjectPointerType() && diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 9ab3bea27449..0d944708d2dd 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1286,7 +1286,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, if (const FunctionProtoType *FPT = dyn_cast_or_null<FunctionProtoType>(FunTy)) { - if (FPT->getNumArgs() == 0) + if (FPT->getNumParams() == 0) ZeroArgCallReturnTy = FunTy->getResultType(); return true; } diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 719574c04e37..7722ba9fe95c 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -376,7 +376,7 @@ static bool MightInstantiateTo(Sema &S, if (FriendTy.getQualifiers() != ContextTy.getQualifiers()) return false; - if (FriendTy->getNumArgs() != ContextTy->getNumArgs()) + if (FriendTy->getNumParams() != ContextTy->getNumParams()) return false; if (!MightInstantiateTo(S, @@ -384,10 +384,9 @@ static bool MightInstantiateTo(Sema &S, FriendTy->getResultType())) return false; - for (unsigned I = 0, E = FriendTy->getNumArgs(); I != E; ++I) - if (!MightInstantiateTo(S, - ContextTy->getArgType(I), - FriendTy->getArgType(I))) + for (unsigned I = 0, E = FriendTy->getNumParams(); I != E; ++I) + if (!MightInstantiateTo(S, ContextTy->getParamType(I), + FriendTy->getParamType(I))) return false; return true; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c3acd52a1ab9..4636c92eccb7 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -767,12 +767,9 @@ static void CheckNonNullArguments(Sema &S, /// Handles the checks for format strings, non-POD arguments to vararg /// functions, and NULL arguments passed to non-NULL parameters. -void Sema::checkCall(NamedDecl *FDecl, - ArrayRef<const Expr *> Args, - unsigned NumProtoArgs, - bool IsMemberFunction, - SourceLocation Loc, - SourceRange Range, +void Sema::checkCall(NamedDecl *FDecl, ArrayRef<const Expr *> Args, + unsigned NumParams, bool IsMemberFunction, + SourceLocation Loc, SourceRange Range, VariadicCallType CallType) { // FIXME: We should check as much as we can in the template definition. if (CurContext->isDependentContext()) @@ -796,7 +793,7 @@ void Sema::checkCall(NamedDecl *FDecl, // Refuse POD arguments that weren't caught by the format string // checks above. if (CallType != VariadicDoesNotApply) { - for (unsigned ArgIdx = NumProtoArgs; ArgIdx < Args.size(); ++ArgIdx) { + for (unsigned ArgIdx = NumParams; ArgIdx < Args.size(); ++ArgIdx) { // Args[ArgIdx] can be null in malformed code. if (const Expr *Arg = Args[ArgIdx]) { if (CheckedVarArgs.empty() || !CheckedVarArgs[ArgIdx]) @@ -826,7 +823,7 @@ void Sema::CheckConstructorCall(FunctionDecl *FDecl, SourceLocation Loc) { VariadicCallType CallType = Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply; - checkCall(FDecl, Args, Proto->getNumArgs(), + checkCall(FDecl, Args, Proto->getNumParams(), /*IsMemberFunction=*/true, Loc, SourceRange(), CallType); } @@ -840,7 +837,7 @@ bool Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, IsMemberOperatorCall; VariadicCallType CallType = getVariadicCallType(FDecl, Proto, TheCall->getCallee()); - unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0; + unsigned NumParams = Proto ? Proto->getNumParams() : 0; Expr** Args = TheCall->getArgs(); unsigned NumArgs = TheCall->getNumArgs(); if (IsMemberOperatorCall) { @@ -850,8 +847,7 @@ bool Sema::CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, ++Args; --NumArgs; } - checkCall(FDecl, llvm::makeArrayRef<const Expr *>(Args, NumArgs), - NumProtoArgs, + checkCall(FDecl, llvm::makeArrayRef<const Expr *>(Args, NumArgs), NumParams, IsMemberFunction, TheCall->getRParenLoc(), TheCall->getCallee()->getSourceRange(), CallType); @@ -906,15 +902,13 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall, } else { // Ty->isFunctionPointerType() CallType = VariadicFunction; } - unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0; + unsigned NumParams = Proto ? Proto->getNumParams() : 0; - checkCall(NDecl, - llvm::makeArrayRef<const Expr *>(TheCall->getArgs(), - TheCall->getNumArgs()), - NumProtoArgs, /*IsMemberFunction=*/false, - TheCall->getRParenLoc(), + checkCall(NDecl, llvm::makeArrayRef<const Expr *>(TheCall->getArgs(), + TheCall->getNumArgs()), + NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(), TheCall->getCallee()->getSourceRange(), CallType); - + return false; } @@ -923,13 +917,11 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall, bool Sema::CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto) { VariadicCallType CallType = getVariadicCallType(/*FDecl=*/0, Proto, TheCall->getCallee()); - unsigned NumProtoArgs = Proto ? Proto->getNumArgs() : 0; + unsigned NumParams = Proto ? Proto->getNumParams() : 0; - checkCall(/*FDecl=*/0, - llvm::makeArrayRef<const Expr *>(TheCall->getArgs(), - TheCall->getNumArgs()), - NumProtoArgs, /*IsMemberFunction=*/false, - TheCall->getRParenLoc(), + checkCall(/*FDecl=*/0, llvm::makeArrayRef<const Expr *>( + TheCall->getArgs(), TheCall->getNumArgs()), + NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(), TheCall->getCallee()->getSourceRange(), CallType); return false; diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index fb318bc41007..daef51e7be97 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -2297,7 +2297,7 @@ static void AddFunctionParameterChunks(ASTContext &Context, if (const FunctionProtoType *Proto = Function->getType()->getAs<FunctionProtoType>()) if (Proto->isVariadic()) { - if (Proto->getNumArgs() == 0) + if (Proto->getNumParams() == 0) Result.AddPlaceholderChunk("..."); MaybeAddSentinel(Context, Function, Result); @@ -2854,7 +2854,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( Proto->getResultType().getAsString(Policy))); Result.AddChunk(CodeCompletionString::CK_LeftParen); - unsigned NumParams = FDecl? FDecl->getNumParams() : Proto->getNumArgs(); + unsigned NumParams = FDecl ? FDecl->getNumParams() : Proto->getNumParams(); for (unsigned I = 0; I != NumParams; ++I) { if (I) Result.AddChunk(CodeCompletionString::CK_Comma); @@ -2866,7 +2866,7 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( ArgString = FDecl->getParamDecl(I)->getNameAsString(); ArgType = FDecl->getParamDecl(I)->getOriginalType(); } else { - ArgType = Proto->getArgType(I); + ArgType = Proto->getParamType(I); } ArgType.getAsStringInternal(ArgString, Policy); @@ -3925,12 +3925,13 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) { for (unsigned I = 0, N = Results.size(); I != N; ++I) { if (const FunctionType *FType = Results[I].getFunctionType()) if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FType)) - if (Args.size() < Proto->getNumArgs()) { + if (Args.size() < Proto->getNumParams()) { if (ParamType.isNull()) - ParamType = Proto->getArgType(Args.size()); + ParamType = Proto->getParamType(Args.size()); else if (!Context.hasSameUnqualifiedType( - ParamType.getNonReferenceType(), - Proto->getArgType(Args.size()).getNonReferenceType())) { + ParamType.getNonReferenceType(), + Proto->getParamType(Args.size()) + .getNonReferenceType())) { ParamType = QualType(); break; } @@ -3951,8 +3952,8 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, ArrayRef<Expr *> Args) { if (const FunctionProtoType *Proto = FunctionType->getAs<FunctionProtoType>()) { - if (Args.size() < Proto->getNumArgs()) - ParamType = Proto->getArgType(Args.size()); + if (Args.size() < Proto->getNumParams()) + ParamType = Proto->getParamType(Args.size()); } } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6d46903c58b5..f7b7ac87ec98 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1563,12 +1563,10 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, // FunctionDecl. if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(R)) { SmallVector<ParmVarDecl*, 16> Params; - for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) { + for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { ParmVarDecl *parm = - ParmVarDecl::Create(Context, New, SourceLocation(), - SourceLocation(), 0, - FT->getArgType(i), /*TInfo=*/0, - SC_None, 0); + ParmVarDecl::Create(Context, New, SourceLocation(), SourceLocation(), + 0, FT->getParamType(i), /*TInfo=*/0, SC_None, 0); parm->setScopeInfo(0, i); Params.push_back(parm); } @@ -2649,8 +2647,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, // The old declaration provided a function prototype, but the // new declaration does not. Merge in the prototype. assert(!OldProto->hasExceptionSpec() && "Exception spec in C"); - SmallVector<QualType, 16> ParamTypes(OldProto->arg_type_begin(), - OldProto->arg_type_end()); + SmallVector<QualType, 16> ParamTypes(OldProto->param_type_begin(), + OldProto->param_type_end()); NewQType = Context.getFunctionType(NewFuncType->getResultType(), ParamTypes, OldProto->getExtProtoInfo()); @@ -2659,9 +2657,9 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, // Synthesize a parameter for each argument type. SmallVector<ParmVarDecl*, 16> Params; - for (FunctionProtoType::arg_type_iterator - ParamType = OldProto->arg_type_begin(), - ParamEnd = OldProto->arg_type_end(); + for (FunctionProtoType::param_type_iterator + ParamType = OldProto->param_type_begin(), + ParamEnd = OldProto->param_type_end(); ParamType != ParamEnd; ++ParamType) { ParmVarDecl *Param = ParmVarDecl::Create(Context, New, SourceLocation(), @@ -2711,13 +2709,13 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, ParmVarDecl *OldParm = Old->getParamDecl(Idx); ParmVarDecl *NewParm = New->getParamDecl(Idx); if (Context.typesAreCompatible(OldParm->getType(), - NewProto->getArgType(Idx))) { + NewProto->getParamType(Idx))) { ArgTypes.push_back(NewParm->getType()); } else if (Context.typesAreCompatible(OldParm->getType(), NewParm->getType(), /*CompareUnqualified=*/true)) { - GNUCompatibleParamWarning Warn - = { OldParm, NewParm, NewProto->getArgType(Idx) }; + GNUCompatibleParamWarning Warn = { OldParm, NewParm, + NewProto->getParamType(Idx) }; Warnings.push_back(Warn); ArgTypes.push_back(NewParm->getType()); } else @@ -6735,7 +6733,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, NewFD->getType()->castAs<FunctionProtoType>(); QualType Result = SubstAutoType(FPT->getResultType(), Context.DependentTy); - NewFD->setType(Context.getFunctionType(Result, FPT->getArgTypes(), + NewFD->setType(Context.getFunctionType(Result, FPT->getParamTypes(), FPT->getExtProtoInfo())); } @@ -6854,7 +6852,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExceptionSpecType = EST_BasicNoexcept; NewFD->setType(Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); } } @@ -6918,8 +6916,9 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // @endcode // Synthesize a parameter for each argument type. - for (FunctionProtoType::arg_type_iterator AI = FT->arg_type_begin(), - AE = FT->arg_type_end(); AI != AE; ++AI) { + for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(), + AE = FT->param_type_end(); + AI != AE; ++AI) { ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, D.getIdentifierLoc(), *AI); Param->setScopeInfo(0, Params.size()); @@ -7480,7 +7479,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; MD->setType(Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); // Warn that we did this, if we're not performing template instantiation. // In that case, we'll have warned already when the template was defined. @@ -7740,7 +7739,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { if (isa<FunctionNoProtoType>(FT)) return; const FunctionProtoType* FTP = cast<const FunctionProtoType>(FT); - unsigned nparams = FTP->getNumArgs(); + unsigned nparams = FTP->getNumParams(); assert(FD->getNumParams() == nparams); bool HasExtraParameters = (nparams > 3); @@ -7765,7 +7764,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { QualType Expected[] = { Context.IntTy, CharPP, CharPP, CharPP }; for (unsigned i = 0; i < nparams; ++i) { - QualType AT = FTP->getArgType(i); + QualType AT = FTP->getParamType(i); bool mismatch = true; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 054cb6afbde6..c706ab6ff096 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -72,7 +72,7 @@ static bool hasFunctionProto(const Decl *D) { /// hasFunctionProto first). static unsigned getFunctionOrMethodNumArgs(const Decl *D) { if (const FunctionType *FnTy = D->getFunctionType()) - return cast<FunctionProtoType>(FnTy)->getNumArgs(); + return cast<FunctionProtoType>(FnTy)->getNumParams(); if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) return BD->getNumParams(); return cast<ObjCMethodDecl>(D)->param_size(); @@ -80,7 +80,7 @@ static unsigned getFunctionOrMethodNumArgs(const Decl *D) { static QualType getFunctionOrMethodArgType(const Decl *D, unsigned Idx) { if (const FunctionType *FnTy = D->getFunctionType()) - return cast<FunctionProtoType>(FnTy)->getArgType(Idx); + return cast<FunctionProtoType>(FnTy)->getParamType(Idx); if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) return BD->getParamDecl(Idx)->getType(); @@ -4343,8 +4343,9 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, QualType FDTy = FD->getType(); if (const FunctionProtoType *FT = FDTy->getAs<FunctionProtoType>()) { SmallVector<ParmVarDecl*, 16> Params; - for (FunctionProtoType::arg_type_iterator AI = FT->arg_type_begin(), - AE = FT->arg_type_end(); AI != AE; ++AI) { + for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(), + AE = FT->param_type_end(); + AI != AE; ++AI) { ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, Loc, *AI); Param->setScopeInfo(0, Params.size()); Params.push_back(Param); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 608f11ceff8a..df4d66eff62c 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -714,8 +714,9 @@ static bool CheckConstexprParameterTypes(Sema &SemaRef, const FunctionDecl *FD) { unsigned ArgIndex = 0; const FunctionProtoType *FT = FD->getType()->getAs<FunctionProtoType>(); - for (FunctionProtoType::arg_type_iterator i = FT->arg_type_begin(), - e = FT->arg_type_end(); i != e; ++i, ++ArgIndex) { + for (FunctionProtoType::param_type_iterator i = FT->param_type_begin(), + e = FT->param_type_end(); + i != e; ++i, ++ArgIndex) { const ParmVarDecl *PD = FD->getParamDecl(ArgIndex); SourceLocation ParamLoc = PD->getLocation(); if (!(*i)->isDependentType() && @@ -4717,7 +4718,7 @@ updateExceptionSpec(Sema &S, FunctionDecl *FD, const FunctionProtoType *FPT, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); ExceptSpec.getEPI(EPI); FD->setType(S.Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); } static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI(Sema &S, @@ -4822,7 +4823,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) { } // Check for parameter type matching. - QualType ArgType = ExpectedParams ? Type->getArgType(0) : QualType(); + QualType ArgType = ExpectedParams ? Type->getParamType(0) : QualType(); bool HasConstParam = false; if (ExpectedParams && ArgType->isReferenceType()) { // Argument must be reference to possibly-const T. @@ -6225,8 +6226,8 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - - return Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(), EPI); + + return Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), EPI); } /// CheckConstructor - Checks a fully-formed constructor for @@ -6454,7 +6455,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, const FunctionProtoType *Proto = R->getAs<FunctionProtoType>(); // Make sure we don't have any parameters. - if (Proto->getNumArgs() > 0) { + if (Proto->getNumParams() > 0) { Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params); // Delete the parameters. @@ -8388,7 +8389,7 @@ private: void inherit(const CXXConstructorDecl *Ctor) { const FunctionProtoType *CtorType = Ctor->getType()->castAs<FunctionProtoType>(); - ArrayRef<QualType> ArgTypes(CtorType->getArgTypes()); + ArrayRef<QualType> ArgTypes(CtorType->getParamTypes()); FunctionProtoType::ExtProtoInfo EPI = CtorType->getExtProtoInfo(); SourceLocation UsingLoc = getUsingLoc(Ctor->getParent()); @@ -8531,16 +8532,16 @@ private: EPI.ExceptionSpecType = EST_Unevaluated; EPI.ExceptionSpecDecl = DerivedCtor; DerivedCtor->setType(Context.getFunctionType(FPT->getResultType(), - FPT->getArgTypes(), EPI)); + FPT->getParamTypes(), EPI)); // Build the parameter declarations. SmallVector<ParmVarDecl *, 16> ParamDecls; - for (unsigned I = 0, N = FPT->getNumArgs(); I != N; ++I) { + for (unsigned I = 0, N = FPT->getNumParams(); I != N; ++I) { TypeSourceInfo *TInfo = - Context.getTrivialTypeSourceInfo(FPT->getArgType(I), UsingLoc); + Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc); ParmVarDecl *PD = ParmVarDecl::Create( Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/0, - FPT->getArgType(I), TInfo, SC_None, /*DefaultArg=*/0); + FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/0); PD->setScopeInfo(0, I); PD->setImplicit(); ParamDecls.push_back(PD); @@ -9237,8 +9238,9 @@ Sema::ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD) { return ExceptSpec; const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>(); - assert(T->getNumArgs() == 1 && "not a copy assignment op"); - unsigned ArgQuals = T->getArgType(0).getNonReferenceType().getCVRQualifiers(); + assert(T->getNumParams() == 1 && "not a copy assignment op"); + unsigned ArgQuals = + T->getParamType(0).getNonReferenceType().getCVRQualifiers(); // C++ [except.spec]p14: // An implicitly declared special member function (Clause 12) shall have an @@ -10061,8 +10063,8 @@ Sema::ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD) { return ExceptSpec; const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>(); - assert(T->getNumArgs() >= 1 && "not a copy ctor"); - unsigned Quals = T->getArgType(0).getNonReferenceType().getCVRQualifiers(); + assert(T->getNumParams() >= 1 && "not a copy ctor"); + unsigned Quals = T->getParamType(0).getNonReferenceType().getCVRQualifiers(); // C++ [except.spec]p14: // An implicitly declared special member function (Clause 12) shall have an @@ -10635,8 +10637,8 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, const FunctionProtoType *Proto = Constructor->getType()->getAs<FunctionProtoType>(); assert(Proto && "Constructor without a prototype?"); - unsigned NumArgsInProto = Proto->getNumArgs(); - + unsigned NumArgsInProto = Proto->getNumParams(); + // If too few arguments are available, we'll fill in the rest with defaults. if (NumArgs < NumArgsInProto) ConvertedArgs.reserve(NumArgsInProto); diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 81fd3f963172..caa796d1f0a9 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -204,7 +204,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_DynamicNone; QualType NewType = Context.getFunctionType(NewProto->getResultType(), - NewProto->getArgTypes(), EPI); + NewProto->getParamTypes(), EPI); New->setType(NewType); return false; } @@ -225,7 +225,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // Update the type of the function with the appropriate exception // specification. QualType NewType = Context.getFunctionType(NewProto->getResultType(), - NewProto->getArgTypes(), EPI); + NewProto->getParamTypes(), EPI); New->setType(NewType); // Warn about the lack of exception specification. @@ -720,14 +720,13 @@ bool Sema::CheckParamExceptionSpec(const PartialDiagnostic & NoteID, // We shouldn't even be testing this unless the arguments are otherwise // compatible. - assert(Target->getNumArgs() == Source->getNumArgs() && + assert(Target->getNumParams() == Source->getNumParams() && "Functions have different argument counts."); - for (unsigned i = 0, E = Target->getNumArgs(); i != E; ++i) { - if (CheckSpecForTypesEquivalent(*this, - PDiag(diag::err_deep_exception_specs_differ) << 1, - PDiag(), - Target->getArgType(i), TargetLoc, - Source->getArgType(i), SourceLoc)) + for (unsigned i = 0, E = Target->getNumParams(); i != E; ++i) { + if (CheckSpecForTypesEquivalent( + *this, PDiag(diag::err_deep_exception_specs_differ) << 1, PDiag(), + Target->getParamType(i), TargetLoc, Source->getParamType(i), + SourceLoc)) return true; } return false; diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 1bcad3bbd028..6e27b76ba250 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -352,7 +352,7 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, } if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(fn)) { - numFormalParams = proto->getNumArgs(); + numFormalParams = proto->getNumParams(); } else { numFormalParams = 0; } @@ -4017,7 +4017,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, // C99 6.5.2.2p7 - the arguments are implicitly converted, as if by // assignment, to the types of the corresponding parameter, ... - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); bool Invalid = false; unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumArgsInProto; unsigned FnKind = Fn->getType()->isBlockPointerType() @@ -4138,7 +4138,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, VariadicCallType CallType, bool AllowExplicit, bool IsListInitialization) { - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); unsigned NumArgsToCheck = Args.size(); bool Invalid = false; if (Args.size() != NumArgsInProto) @@ -4147,7 +4147,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, unsigned ArgIx = 0; // Continue to check argument types (even if we have too few/many args). for (unsigned i = FirstProtoArg; i != NumArgsToCheck; i++) { - QualType ProtoArgType = Proto->getArgType(i); + QualType ProtoArgType = Proto->getParamType(i); Expr *Arg; ParmVarDecl *Param; @@ -4175,11 +4175,12 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, (!Param || !Param->hasAttr<CFConsumedAttr>())) CFAudited = true; - InitializedEntity Entity = Param ? - InitializedEntity::InitializeParameter(Context, Param, ProtoArgType) - : InitializedEntity::InitializeParameter(Context, ProtoArgType, - Proto->isArgConsumed(i)); - + InitializedEntity Entity = + Param ? InitializedEntity::InitializeParameter(Context, Param, + ProtoArgType) + : InitializedEntity::InitializeParameter( + Context, ProtoArgType, Proto->isParamConsumed(i)); + // Remember that parameter belongs to a CF audited API. if (CFAudited) Entity.setParameterCFAudited(); @@ -4674,11 +4675,9 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, for (unsigned i = 0, e = Args.size(); i != e; i++) { Expr *Arg = Args[i]; - if (Proto && i < Proto->getNumArgs()) { - InitializedEntity Entity - = InitializedEntity::InitializeParameter(Context, - Proto->getArgType(i), - Proto->isArgConsumed(i)); + if (Proto && i < Proto->getNumParams()) { + InitializedEntity Entity = InitializedEntity::InitializeParameter( + Context, Proto->getParamType(i), Proto->isParamConsumed(i)); ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(), Owned(Arg)); @@ -10356,8 +10355,9 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, // Fake up parameter variables if we have a typedef, like // ^ fntype { ... } } else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) { - for (FunctionProtoType::arg_type_iterator - I = Fn->arg_type_begin(), E = Fn->arg_type_end(); I != E; ++I) { + for (FunctionProtoType::param_type_iterator I = Fn->param_type_begin(), + E = Fn->param_type_end(); + I != E; ++I) { ParmVarDecl *Param = BuildParmVarDeclForTypedef(CurBlock->TheDecl, ParamInfo.getLocStart(), @@ -10470,7 +10470,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals = 0; // FIXME: silently? EPI.ExtInfo = Ext; - BlockTy = Context.getFunctionType(RetTy, FPT->getArgTypes(), EPI); + BlockTy = Context.getFunctionType(RetTy, FPT->getParamTypes(), EPI); } // If we don't have a function type, just build one from nothing. @@ -12897,7 +12897,7 @@ ExprResult RebuildUnknownAnyExpr::VisitCallExpr(CallExpr *E) { // This is a hack, but it is far superior to moving the // corresponding target-specific code from IR-gen to Sema/AST. - ArrayRef<QualType> ParamTypes = Proto->getArgTypes(); + ArrayRef<QualType> ParamTypes = Proto->getParamTypes(); SmallVector<QualType, 8> ArgTypes; if (ParamTypes.empty() && Proto->isVariadic()) { // the special case ArgTypes.reserve(E->getNumArgs()); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index a7723d4b263d..29160590729a 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1735,8 +1735,8 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, SmallVector<QualType, 4> ArgTypes; ArgTypes.push_back(Context.VoidPtrTy); - for (unsigned I = 1, N = Proto->getNumArgs(); I < N; ++I) - ArgTypes.push_back(Proto->getArgType(I)); + for (unsigned I = 1, N = Proto->getNumParams(); I < N; ++I) + ArgTypes.push_back(Proto->getParamType(I)); FunctionProtoType::ExtProtoInfo EPI; EPI.Variadic = Proto->isVariadic(); @@ -3513,7 +3513,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, return false; // TODO: check whether evaluating default arguments can throw. // For now, we'll be conservative and assume that they can throw. - if (!CPT->isNothrow(Self.Context) || CPT->getNumArgs() > 1) + if (!CPT->isNothrow(Self.Context) || CPT->getNumParams() > 1) return false; } } @@ -3551,7 +3551,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, return false; // FIXME: check whether evaluating default arguments can throw. // For now, we'll be conservative and assume that they can throw. - if (!CPT->isNothrow(Self.Context) || CPT->getNumArgs() > 0) + if (!CPT->isNothrow(Self.Context) || CPT->getNumParams() > 0) return false; } } diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 717dff939924..5481676ab635 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -367,7 +367,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class, QualType Result = FPT->getResultType(); if (Result->isUndeducedType()) { Result = SubstAutoType(Result, Context.DependentTy); - MethodType = Context.getFunctionType(Result, FPT->getArgTypes(), + MethodType = Context.getFunctionType(Result, FPT->getParamTypes(), FPT->getExtProtoInfo()); } } @@ -1164,8 +1164,9 @@ static void addFunctionPointerConversion(Sema &S, InvokerExtInfo.TypeQuals = 0; assert(InvokerExtInfo.RefQualifier == RQ_None && "Lambda's call operator should not have a reference qualifier"); - InvokerFunctionTy = S.Context.getFunctionType(CallOpProto->getResultType(), - CallOpProto->getArgTypes(), InvokerExtInfo); + InvokerFunctionTy = + S.Context.getFunctionType(CallOpProto->getResultType(), + CallOpProto->getParamTypes(), InvokerExtInfo); PtrToFunctionTy = S.Context.getPointerType(InvokerFunctionTy); } @@ -1331,7 +1332,7 @@ static void addBlockPointerConversion(Sema &S, FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo(); ExtInfo.TypeQuals = 0; QualType FunctionTy = S.Context.getFunctionType( - Proto->getResultType(), Proto->getArgTypes(), ExtInfo); + Proto->getResultType(), Proto->getParamTypes(), ExtInfo); BlockPtrTy = S.Context.getBlockPointerType(FunctionTy); } @@ -1456,7 +1457,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, const FunctionProtoType *Proto = CallOperator->getType()->getAs<FunctionProtoType>(); QualType FunctionTy = Context.getFunctionType( - LSI->ReturnType, Proto->getArgTypes(), Proto->getExtProtoInfo()); + LSI->ReturnType, Proto->getParamTypes(), Proto->getExtProtoInfo()); CallOperator->setType(FunctionTy); } // C++ [expr.prim.lambda]p7: diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 6b70ca2c9d83..7b6536973ae4 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2193,9 +2193,10 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) { // types and those associated with the return type. case Type::FunctionProto: { const FunctionProtoType *Proto = cast<FunctionProtoType>(T); - for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(), - ArgEnd = Proto->arg_type_end(); - Arg != ArgEnd; ++Arg) + for (FunctionProtoType::param_type_iterator + Arg = Proto->param_type_begin(), + ArgEnd = Proto->param_type_end(); + Arg != ArgEnd; ++Arg) Queue.push_back(Arg->getTypePtr()); // fallthrough } @@ -2348,20 +2349,20 @@ IsAcceptableNonMemberOperatorCandidate(FunctionDecl *Fn, return true; const FunctionProtoType *Proto = Fn->getType()->getAs<FunctionProtoType>(); - if (Proto->getNumArgs() < 1) + if (Proto->getNumParams() < 1) return false; if (T1->isEnumeralType()) { - QualType ArgType = Proto->getArgType(0).getNonReferenceType(); + QualType ArgType = Proto->getParamType(0).getNonReferenceType(); if (Context.hasSameUnqualifiedType(T1, ArgType)) return true; } - if (Proto->getNumArgs() < 2) + if (Proto->getNumParams() < 2) return false; if (!T2.isNull() && T2->isEnumeralType()) { - QualType ArgType = Proto->getArgType(1).getNonReferenceType(); + QualType ArgType = Proto->getParamType(1).getNonReferenceType(); if (Context.hasSameUnqualifiedType(T2, ArgType)) return true; } @@ -4590,7 +4591,7 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) { if (ValType->isAnyPointerType() || ValType->isReferenceType()) ValType = ValType->getPointeeType(); if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>()) - if (FPT->getNumArgs() == NumArgs) + if (FPT->getNumParams() == NumArgs) return true; } } diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 366f38e31daf..bbe68a14a670 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1015,9 +1015,9 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old, // parameters (C++ 1.3.10), which includes the presence or absence // of the ellipsis; see C++ DR 357). if (OldQType != NewQType && - (OldType->getNumArgs() != NewType->getNumArgs() || + (OldType->getNumParams() != NewType->getNumParams() || OldType->isVariadic() != NewType->isVariadic() || - !FunctionArgTypesAreEqual(OldType, NewType))) + !FunctionParamTypesAreEqual(OldType, NewType))) return true; // C++ [temp.over.link]p4: @@ -2305,7 +2305,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, // Perform the quick checks that will tell us whether these // function types are obviously different. - if (FromFunctionType->getNumArgs() != ToFunctionType->getNumArgs() || + if (FromFunctionType->getNumParams() != ToFunctionType->getNumParams() || FromFunctionType->isVariadic() != ToFunctionType->isVariadic() || FromFunctionType->getTypeQuals() != ToFunctionType->getTypeQuals()) return false; @@ -2325,10 +2325,10 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, } // Check argument types. - for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs(); + for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams(); ArgIdx != NumArgs; ++ArgIdx) { - QualType FromArgType = FromFunctionType->getArgType(ArgIdx); - QualType ToArgType = ToFunctionType->getArgType(ArgIdx); + QualType FromArgType = FromFunctionType->getParamType(ArgIdx); + QualType ToArgType = ToFunctionType->getParamType(ArgIdx); if (Context.getCanonicalType(FromArgType) == Context.getCanonicalType(ToArgType)) { // Okay, the types match exactly. Nothing to do. @@ -2453,7 +2453,7 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, // Perform the quick checks that will tell us whether these // function types are obviously different. - if (FromFunctionType->getNumArgs() != ToFunctionType->getNumArgs() || + if (FromFunctionType->getNumParams() != ToFunctionType->getNumParams() || FromFunctionType->isVariadic() != ToFunctionType->isVariadic()) return false; @@ -2486,11 +2486,11 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, } // Check argument types. - for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs(); + for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams(); ArgIdx != NumArgs; ++ArgIdx) { IncompatibleObjC = false; - QualType FromArgType = FromFunctionType->getArgType(ArgIdx); - QualType ToArgType = ToFunctionType->getArgType(ArgIdx); + QualType FromArgType = FromFunctionType->getParamType(ArgIdx); + QualType ToArgType = ToFunctionType->getParamType(ArgIdx); if (Context.hasSameType(FromArgType, ToArgType)) { // Okay, the types match exactly. Nothing to do. } else if (isObjCPointerConversion(ToArgType, FromArgType, @@ -2575,18 +2575,18 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, return; } - if (FromFunction->getNumArgs() != ToFunction->getNumArgs()) { - PDiag << ft_parameter_arity << ToFunction->getNumArgs() - << FromFunction->getNumArgs(); + if (FromFunction->getNumParams() != ToFunction->getNumParams()) { + PDiag << ft_parameter_arity << ToFunction->getNumParams() + << FromFunction->getNumParams(); return; } // Handle different parameter types. unsigned ArgPos; - if (!FunctionArgTypesAreEqual(FromFunction, ToFunction, &ArgPos)) { + if (!FunctionParamTypesAreEqual(FromFunction, ToFunction, &ArgPos)) { PDiag << ft_parameter_mismatch << ArgPos + 1 - << ToFunction->getArgType(ArgPos) - << FromFunction->getArgType(ArgPos); + << ToFunction->getParamType(ArgPos) + << FromFunction->getParamType(ArgPos); return; } @@ -2609,19 +2609,21 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, PDiag << ft_default; } -/// FunctionArgTypesAreEqual - This routine checks two function proto types +/// FunctionParamTypesAreEqual - This routine checks two function proto types /// for equality of their argument types. Caller has already checked that /// they have same number of arguments. If the parameters are different, /// ArgPos will have the parameter index of the first different parameter. -bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType, - const FunctionProtoType *NewType, - unsigned *ArgPos) { - for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(), - N = NewType->arg_type_begin(), - E = OldType->arg_type_end(); O && (O != E); ++O, ++N) { +bool Sema::FunctionParamTypesAreEqual(const FunctionProtoType *OldType, + const FunctionProtoType *NewType, + unsigned *ArgPos) { + for (FunctionProtoType::param_type_iterator O = OldType->param_type_begin(), + N = NewType->param_type_begin(), + E = OldType->param_type_end(); + O && (O != E); ++O, ++N) { if (!Context.hasSameType(O->getUnqualifiedType(), N->getUnqualifiedType())) { - if (ArgPos) *ArgPos = O - OldType->arg_type_begin(); + if (ArgPos) + *ArgPos = O - OldType->param_type_begin(); return false; } } @@ -2936,8 +2938,8 @@ static bool isFirstArgumentCompatibleWithType(ASTContext &Context, QualType Type) { const FunctionProtoType *CtorType = Constructor->getType()->getAs<FunctionProtoType>(); - if (CtorType->getNumArgs() > 0) { - QualType FirstArg = CtorType->getArgType(0); + if (CtorType->getNumParams() > 0) { + QualType FirstArg = CtorType->getParamType(0); if (Context.hasSameUnqualifiedType(Type, FirstArg.getNonReferenceType())) return true; } @@ -5560,7 +5562,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, Candidate.IgnoreObjectArgument = false; Candidate.ExplicitCallArguments = Args.size(); - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); // (C++ 13.3.2p2): A candidate function having fewer than m // parameters is viable only if it has an ellipsis in its parameter @@ -5602,7 +5604,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding // parameter of F. - QualType ParamType = Proto->getArgType(ArgIdx); + QualType ParamType = Proto->getParamType(ArgIdx); Candidate.Conversions[ArgIdx] = TryCopyInitialization(*this, Args[ArgIdx], ParamType, SuppressUserConversions, @@ -5803,7 +5805,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, Candidate.IgnoreObjectArgument = false; Candidate.ExplicitCallArguments = Args.size(); - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); // (C++ 13.3.2p2): A candidate function having fewer than m // parameters is viable only if it has an ellipsis in its parameter @@ -5853,7 +5855,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding // parameter of F. - QualType ParamType = Proto->getArgType(ArgIdx); + QualType ParamType = Proto->getParamType(ArgIdx); Candidate.Conversions[ArgIdx + 1] = TryCopyInitialization(*this, Args[ArgIdx], ParamType, SuppressUserConversions, @@ -6285,7 +6287,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion(); // Find the - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); // (C++ 13.3.2p2): A candidate function having fewer than m // parameters is viable only if it has an ellipsis in its parameter @@ -6313,7 +6315,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding // parameter of F. - QualType ParamType = Proto->getArgType(ArgIdx); + QualType ParamType = Proto->getParamType(ArgIdx); Candidate.Conversions[ArgIdx + 1] = TryCopyInitialization(*this, Args[ArgIdx], ParamType, /*SuppressUserConversions=*/false, @@ -8739,18 +8741,18 @@ void DiagnoseArityMismatch(Sema &S, Decl *D, unsigned NumFormalArgs) { // at least / at most / exactly unsigned mode, modeCount; if (NumFormalArgs < MinParams) { - if (MinParams != FnTy->getNumArgs() || - FnTy->isVariadic() || FnTy->isTemplateVariadic()) + if (MinParams != FnTy->getNumParams() || FnTy->isVariadic() || + FnTy->isTemplateVariadic()) mode = 0; // "at least" else mode = 2; // "exactly" modeCount = MinParams; } else { - if (MinParams != FnTy->getNumArgs()) + if (MinParams != FnTy->getNumParams()) mode = 1; // "at most" else mode = 2; // "exactly" - modeCount = FnTy->getNumArgs(); + modeCount = FnTy->getNumParams(); } std::string Description; @@ -9354,15 +9356,14 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, } // Fill in the rest of the conversions. - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) { if (ArgIdx < NumArgsInProto) { - Cand->Conversions[ConvIdx] - = TryCopyInitialization(S, Args[ArgIdx], Proto->getArgType(ArgIdx), - SuppressUserConversions, - /*InOverloadResolution=*/true, - /*AllowObjCWritebackConversion=*/ - S.getLangOpts().ObjCAutoRefCount); + Cand->Conversions[ConvIdx] = TryCopyInitialization( + S, Args[ArgIdx], Proto->getParamType(ArgIdx), SuppressUserConversions, + /*InOverloadResolution=*/true, + /*AllowObjCWritebackConversion=*/ + S.getLangOpts().ObjCAutoRefCount); // Store the FixIt in the candidate if it exists. if (!Unfixable && Cand->Conversions[ConvIdx].isBad()) Unfixable = !Cand->TryToFixBadConversion(ConvIdx, S); @@ -11683,7 +11684,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, const FunctionProtoType *Proto = Method->getType()->getAs<FunctionProtoType>(); - unsigned NumArgsInProto = Proto->getNumArgs(); + unsigned NumArgsInProto = Proto->getNumParams(); DeclarationNameInfo OpLocInfo( Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc); diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index ca81472b3c55..dcfdd319990b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -3892,8 +3892,8 @@ bool UnnamedLocalNoLinkageFinder::VisitExtVectorType(const ExtVectorType* T) { bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType( const FunctionProtoType* T) { - for (FunctionProtoType::arg_type_iterator A = T->arg_type_begin(), - AEnd = T->arg_type_end(); + for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), + AEnd = T->param_type_end(); A != AEnd; ++A) { if (Visit(*A)) return true; @@ -6514,8 +6514,8 @@ bool Sema::CheckFunctionTemplateSpecialization( const FunctionProtoType *FPT = FT->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; - FT = Context.getFunctionType(FPT->getResultType(), FPT->getArgTypes(), - EPI); + FT = Context.getFunctionType(FPT->getResultType(), + FPT->getParamTypes(), EPI); } } diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 8e1122aa43a5..256bb7c3951b 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1382,12 +1382,11 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, Info, Deduced, 0)) return Result; - return DeduceTemplateArguments(S, TemplateParams, - FunctionProtoParam->arg_type_begin(), - FunctionProtoParam->getNumArgs(), - FunctionProtoArg->arg_type_begin(), - FunctionProtoArg->getNumArgs(), - Info, Deduced, SubTDF); + return DeduceTemplateArguments( + S, TemplateParams, FunctionProtoParam->param_type_begin(), + FunctionProtoParam->getNumParams(), + FunctionProtoArg->param_type_begin(), + FunctionProtoArg->getNumParams(), Info, Deduced, SubTDF); } case Type::InjectedClassName: { @@ -3751,7 +3750,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( FunctionProtoType::ExtProtoInfo EPI = InvokerFPT->getExtProtoInfo(); EPI.TypeQuals = 0; InvokerSpecialized->setType(S.Context.getFunctionType( - InvokerFPT->getResultType(), InvokerFPT->getArgTypes(),EPI)); + InvokerFPT->getResultType(), InvokerFPT->getParamTypes(), EPI)); return Sema::TDK_Success; } /// \brief Deduce template arguments for a templated conversion @@ -4231,10 +4230,10 @@ static bool isAtLeastAsSpecializedAs(Sema &S, ++Skip1; } - Args1.insert(Args1.end(), - Proto1->arg_type_begin() + Skip1, Proto1->arg_type_end()); - Args2.insert(Args2.end(), - Proto2->arg_type_begin() + Skip2, Proto2->arg_type_end()); + Args1.insert(Args1.end(), Proto1->param_type_begin() + Skip1, + Proto1->param_type_end()); + Args2.insert(Args2.end(), Proto2->param_type_begin() + Skip2, + Proto2->param_type_end()); // C++ [temp.func.order]p5: // The presence of unused ellipsis and default arguments has no effect on @@ -4883,8 +4882,8 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T, const FunctionProtoType *Proto = cast<FunctionProtoType>(T); MarkUsedTemplateParameters(Ctx, Proto->getResultType(), OnlyDeduced, Depth, Used); - for (unsigned I = 0, N = Proto->getNumArgs(); I != N; ++I) - MarkUsedTemplateParameters(Ctx, Proto->getArgType(I), OnlyDeduced, + for (unsigned I = 0, N = Proto->getNumParams(); I != N; ++I) + MarkUsedTemplateParameters(Ctx, Proto->getParamType(I), OnlyDeduced, Depth, Used); break; } diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 773fd923f1a6..bd8f5d309344 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1218,7 +1218,7 @@ static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo(); NewEPI.ExtInfo = OrigFunc->getExtInfo(); return Context.getFunctionType(NewFunc->getResultType(), - NewFunc->getArgTypes(), NewEPI); + NewFunc->getParamTypes(), NewEPI); } /// Normal class members are of more specific types and therefore @@ -2969,7 +2969,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, ParmVarDecl *OldParam = OldProtoLoc.getArg(i); if (!OldParam) { Params.push_back(SemaRef.BuildParmVarDeclForTypedef( - D, D->getLocation(), OldProto->getArgType(i))); + D, D->getLocation(), OldProto->getParamType(i))); continue; } @@ -3160,7 +3160,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New, EPI.NoexceptExpr = NoexceptExpr; New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(), - NewProto->getArgTypes(), EPI)); + NewProto->getParamTypes(), EPI)); } void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, @@ -3177,7 +3177,7 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_None; Decl->setType(Context.getFunctionType(Proto->getResultType(), - Proto->getArgTypes(), EPI)); + Proto->getParamTypes(), EPI)); return; } @@ -3261,7 +3261,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, EPI.ExceptionSpecDecl = New; EPI.ExceptionSpecTemplate = ExceptionSpecTemplate; New->setType(SemaRef.Context.getFunctionType( - NewProto->getResultType(), NewProto->getArgTypes(), EPI)); + NewProto->getResultType(), NewProto->getParamTypes(), EPI)); } else { ::InstantiateExceptionSpec(SemaRef, New, Proto, TemplateArgs); } diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 4eef099375f1..a84cad19aecf 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -3114,7 +3114,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - T = Context.getFunctionType(FnTy->getResultType(), FnTy->getArgTypes(), + T = Context.getFunctionType(FnTy->getResultType(), FnTy->getParamTypes(), EPI); // Rebuild any parens around the identifier in the function type. for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 36a6520fcd04..97f4a4f45481 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -4356,11 +4356,9 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, QualType ResultType; if (T->hasTrailingReturn()) { - if (getDerived().TransformFunctionTypeParams(TL.getBeginLoc(), - TL.getParmArray(), - TL.getNumArgs(), - TL.getTypePtr()->arg_type_begin(), - ParamTypes, &ParamDecls)) + if (getDerived().TransformFunctionTypeParams( + TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(), + TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls)) return QualType(); { @@ -4382,21 +4380,19 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, if (ResultType.isNull()) return QualType(); - if (getDerived().TransformFunctionTypeParams(TL.getBeginLoc(), - TL.getParmArray(), - TL.getNumArgs(), - TL.getTypePtr()->arg_type_begin(), - ParamTypes, &ParamDecls)) + if (getDerived().TransformFunctionTypeParams( + TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(), + TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls)) return QualType(); } // FIXME: Need to transform the exception-specification too. QualType Result = TL.getType(); - if (getDerived().AlwaysRebuild() || - ResultType != T->getResultType() || - T->getNumArgs() != ParamTypes.size() || - !std::equal(T->arg_type_begin(), T->arg_type_end(), ParamTypes.begin())) { + if (getDerived().AlwaysRebuild() || ResultType != T->getResultType() || + T->getNumParams() != ParamTypes.size() || + !std::equal(T->param_type_begin(), T->param_type_end(), + ParamTypes.begin())) { Result = getDerived().RebuildFunctionProtoType(ResultType, ParamTypes, T->getExtProtoInfo()); if (Result.isNull()) diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index b9d7ca834c0c..14b163facaa0 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -196,9 +196,9 @@ void ASTTypeWriter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) { void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) { VisitFunctionType(T); - Record.push_back(T->getNumArgs()); - for (unsigned I = 0, N = T->getNumArgs(); I != N; ++I) - Writer.AddTypeRef(T->getArgType(I), Record); + Record.push_back(T->getNumParams()); + for (unsigned I = 0, N = T->getNumParams(); I != N; ++I) + Writer.AddTypeRef(T->getParamType(I), Record); Record.push_back(T->isVariadic()); Record.push_back(T->hasTrailingReturn()); Record.push_back(T->getTypeQuals()); diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp index 415d3ecc39b5..0ee4a433edfb 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -302,11 +302,11 @@ void WalkAST::checkCall_gets(const CallExpr *CE, const FunctionDecl *FD) { return; // Verify that the function takes a single argument. - if (FPT->getNumArgs() != 1) + if (FPT->getNumParams() != 1) return; // Is the argument a 'char*'? - const PointerType *PT = FPT->getArgType(0)->getAs<PointerType>(); + const PointerType *PT = FPT->getParamType(0)->getAs<PointerType>(); if (!PT) return; @@ -338,15 +338,15 @@ void WalkAST::checkCall_getpw(const CallExpr *CE, const FunctionDecl *FD) { return; // Verify that the function takes two arguments. - if (FPT->getNumArgs() != 2) + if (FPT->getNumParams() != 2) return; // Verify the first argument type is integer. - if (!FPT->getArgType(0)->isIntegralOrUnscopedEnumerationType()) + if (!FPT->getParamType(0)->isIntegralOrUnscopedEnumerationType()) return; // Verify the second argument type is char*. - const PointerType *PT = FPT->getArgType(1)->getAs<PointerType>(); + const PointerType *PT = FPT->getParamType(1)->getAs<PointerType>(); if (!PT) return; @@ -382,11 +382,11 @@ void WalkAST::checkCall_mktemp(const CallExpr *CE, const FunctionDecl *FD) { return; // Verify that the function takes a single argument. - if (FPT->getNumArgs() != 1) + if (FPT->getNumParams() != 1) return; // Verify that the argument is Pointer Type. - const PointerType *PT = FPT->getArgType(0)->getAs<PointerType>(); + const PointerType *PT = FPT->getParamType(0)->getAs<PointerType>(); if (!PT) return; @@ -551,14 +551,14 @@ bool WalkAST::checkCall_strCommon(const CallExpr *CE, const FunctionDecl *FD) { return false; // Verify the function takes two arguments, three in the _chk version. - int numArgs = FPT->getNumArgs(); + int numArgs = FPT->getNumParams(); if (numArgs != 2 && numArgs != 3) return false; // Verify the type for both arguments. for (int i = 0; i < 2; i++) { // Verify that the arguments are pointers. - const PointerType *PT = FPT->getArgType(i)->getAs<PointerType>(); + const PointerType *PT = FPT->getParamType(i)->getAs<PointerType>(); if (!PT) return false; @@ -584,17 +584,16 @@ void WalkAST::checkCall_rand(const CallExpr *CE, const FunctionDecl *FD) { if (!FTP) return; - if (FTP->getNumArgs() == 1) { + if (FTP->getNumParams() == 1) { // Is the argument an 'unsigned short *'? // (Actually any integer type is allowed.) - const PointerType *PT = FTP->getArgType(0)->getAs<PointerType>(); + const PointerType *PT = FTP->getParamType(0)->getAs<PointerType>(); if (!PT) return; if (! PT->getPointeeType()->isIntegralOrUnscopedEnumerationType()) return; - } - else if (FTP->getNumArgs() != 0) + } else if (FTP->getNumParams() != 0) return; // Issue a warning. @@ -628,7 +627,7 @@ void WalkAST::checkCall_random(const CallExpr *CE, const FunctionDecl *FD) { return; // Verify that the function takes no argument. - if (FTP->getNumArgs() != 0) + if (FTP->getNumParams() != 0) return; // Issue a warning. @@ -704,12 +703,12 @@ void WalkAST::checkUncheckedReturnValue(CallExpr *CE) { // Verify that the function takes one or two arguments (depending on // the function). - if (FTP->getNumArgs() != (identifierid < 4 ? 1 : 2)) + if (FTP->getNumParams() != (identifierid < 4 ? 1 : 2)) return; // The arguments must be integers. - for (unsigned i = 0; i < FTP->getNumArgs(); i++) - if (! FTP->getArgType(i)->isIntegralOrUnscopedEnumerationType()) + for (unsigned i = 0; i < FTP->getNumParams(); i++) + if (!FTP->getParamType(i)->isIntegralOrUnscopedEnumerationType()) return; // Issue a warning. diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 4302cc7fd293..24a0519eb265 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -1174,7 +1174,7 @@ RetainSummaryManager::getUnarySummary(const FunctionType* FT, // Sanity check that this is *really* a unary function. This can // happen if people do weird things. const FunctionProtoType* FTP = dyn_cast<FunctionProtoType>(FT); - if (!FTP || FTP->getNumArgs() != 1) + if (!FTP || FTP->getNumParams() != 1) return getPersistentStopSummary(); assert (ScratchArgs.isEmpty()); |