diff options
-rw-r--r-- | clang/include/clang/AST/DataRecursiveASTVisitor.h | 10 | ||||
-rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 10 | ||||
-rw-r--r-- | clang/include/clang/AST/Type.h | 49 | ||||
-rw-r--r-- | clang/include/clang/AST/TypeLoc.h | 16 | ||||
-rw-r--r-- | clang/include/clang/Sema/Sema.h | 6 | ||||
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Type.cpp | 68 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 96 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 34 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 13 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 18 | ||||
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 10 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 4 | ||||
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 8 |
20 files changed, 190 insertions, 200 deletions
diff --git a/clang/include/clang/AST/DataRecursiveASTVisitor.h b/clang/include/clang/AST/DataRecursiveASTVisitor.h index 7b9036ebfd5..8038ffa7c3d 100644 --- a/clang/include/clang/AST/DataRecursiveASTVisitor.h +++ b/clang/include/clang/AST/DataRecursiveASTVisitor.h @@ -1103,9 +1103,9 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType, { const FunctionProtoType *T = TL.getTypePtr(); - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) { - if (TL.getArg(I)) { - TRY_TO(TraverseDecl(TL.getArg(I))); + for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) { + if (TL.getParam(I)) { + TRY_TO(TraverseDecl(TL.getParam(I))); } else if (I < T->getNumParams()) { TRY_TO(TraverseType(T->getParamType(I))); } @@ -2191,8 +2191,8 @@ bool DataRecursiveASTVisitor<Derived>::TraverseLambdaExpr(LambdaExpr *S) { } else if (FunctionProtoTypeLoc Proto = TL.getAs<FunctionProtoTypeLoc>()) { if (S->hasExplicitParameters()) { // Visit parameters. - for (unsigned I = 0, N = Proto.getNumArgs(); I != N; ++I) { - TRY_TO(TraverseDecl(Proto.getArg(I))); + for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) { + TRY_TO(TraverseDecl(Proto.getParam(I))); } } else { TRY_TO(TraverseTypeLoc(Proto.getResultLoc())); diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 9e98cc9d30c..d34b30a9f1a 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -1184,9 +1184,9 @@ DEF_TRAVERSE_TYPELOC(FunctionProtoType, { const FunctionProtoType *T = TL.getTypePtr(); - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) { - if (TL.getArg(I)) { - TRY_TO(TraverseDecl(TL.getArg(I))); + for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) { + if (TL.getParam(I)) { + TRY_TO(TraverseDecl(TL.getParam(I))); } else if (I < T->getNumParams()) { TRY_TO(TraverseType(T->getParamType(I))); } @@ -2215,8 +2215,8 @@ bool RecursiveASTVisitor<Derived>::TraverseLambdaExpr(LambdaExpr *S) { } else if (FunctionProtoTypeLoc Proto = TL.getAs<FunctionProtoTypeLoc>()) { if (S->hasExplicitParameters()) { // Visit parameters. - for (unsigned I = 0, N = Proto.getNumArgs(); I != N; ++I) { - TRY_TO(TraverseDecl(Proto.getArg(I))); + for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) { + TRY_TO(TraverseDecl(Proto.getParam(I))); } } else { TRY_TO(TraverseTypeLoc(Proto.getResultLoc())); diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 6e19f8bea94..82e947fb5bf 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2839,27 +2839,26 @@ public: } }; -/// FunctionProtoType - Represents a prototype with argument type info, e.g. +/// FunctionProtoType - Represents a prototype with parameter type info, e.g. /// 'int foo(int)' or 'int foo(void)'. 'void' is represented as having no -/// arguments, not as having a single void argument. Such a type can have an +/// parameters, not as having a single void parameter. Such a type can have an /// exception specification, but this specification is not part of the canonical /// type. class FunctionProtoType : public FunctionType, public llvm::FoldingSetNode { public: /// ExtProtoInfo - Extra information about a function prototype. struct ExtProtoInfo { - ExtProtoInfo() : - Variadic(false), HasTrailingReturn(false), TypeQuals(0), - ExceptionSpecType(EST_None), RefQualifier(RQ_None), - NumExceptions(0), Exceptions(0), NoexceptExpr(0), - ExceptionSpecDecl(0), ExceptionSpecTemplate(0), - ConsumedArguments(0) {} + ExtProtoInfo() + : Variadic(false), HasTrailingReturn(false), TypeQuals(0), + ExceptionSpecType(EST_None), RefQualifier(RQ_None), NumExceptions(0), + Exceptions(0), NoexceptExpr(0), ExceptionSpecDecl(0), + ExceptionSpecTemplate(0), ConsumedParameters(0) {} ExtProtoInfo(CallingConv CC) : ExtInfo(CC), Variadic(false), HasTrailingReturn(false), TypeQuals(0), ExceptionSpecType(EST_None), RefQualifier(RQ_None), NumExceptions(0), Exceptions(0), NoexceptExpr(0), ExceptionSpecDecl(0), - ExceptionSpecTemplate(0), ConsumedArguments(0) {} + ExceptionSpecTemplate(0), ConsumedParameters(0) {} FunctionType::ExtInfo ExtInfo; bool Variadic : 1; @@ -2872,7 +2871,7 @@ public: Expr *NoexceptExpr; FunctionDecl *ExceptionSpecDecl; FunctionDecl *ExceptionSpecTemplate; - const bool *ConsumedArguments; + const bool *ConsumedParameters; }; private: @@ -2887,11 +2886,11 @@ private: return false; } - FunctionProtoType(QualType result, ArrayRef<QualType> args, + FunctionProtoType(QualType result, ArrayRef<QualType> params, QualType canonical, const ExtProtoInfo &epi); - /// NumArgs - The number of arguments this function has, not counting '...'. - unsigned NumArgs : 15; + /// The number of parameters this function has, not counting '...'. + unsigned NumParams : 15; /// NumExceptions - The number of types in the exception spec, if any. unsigned NumExceptions : 9; @@ -2899,8 +2898,8 @@ private: /// ExceptionSpecType - The type of exception specification this function has. unsigned ExceptionSpecType : 3; - /// HasAnyConsumedArgs - Whether this function has any consumed arguments. - unsigned HasAnyConsumedArgs : 1; + /// HasAnyConsumedParams - Whether this function has any consumed parameters. + unsigned HasAnyConsumedParams : 1; /// Variadic - Whether the function is variadic. unsigned Variadic : 1; @@ -2913,8 +2912,8 @@ private: /// This is a value of type \c RefQualifierKind. unsigned RefQualifier : 2; - // ArgInfo - There is an variable size array after the class in memory that - // holds the argument types. + // ParamInfo - There is an variable size array after the class in memory that + // holds the parameter types. // Exceptions - There is another variable size array after ArgInfo that // holds the exception types. @@ -2927,9 +2926,9 @@ private: // instantiate this function type's exception specification, and the function // from which it should be instantiated. - // ConsumedArgs - A variable size array, following Exceptions - // and of length NumArgs, holding flags indicating which arguments - // are consumed. This only appears if HasAnyConsumedArgs is true. + // ConsumedParameters - A variable size array, following Exceptions + // and of length NumParams, holding flags indicating which parameters + // are consumed. This only appears if HasAnyConsumedParams is true. friend class ASTContext; // ASTContext creates these. @@ -2947,9 +2946,9 @@ private: } public: - unsigned getNumParams() const { return NumArgs; } + unsigned getNumParams() const { return NumParams; } QualType getParamType(unsigned i) const { - assert(i < NumArgs && "Invalid parameter index"); + assert(i < NumParams && "invalid parameter index"); return param_type_begin()[i]; } ArrayRef<QualType> getParamTypes() const { @@ -2976,7 +2975,7 @@ public: EPI.ExceptionSpecDecl = getExceptionSpecDecl(); } if (hasAnyConsumedParams()) - EPI.ConsumedArguments = getConsumedParamsBuffer(); + EPI.ConsumedParameters = getConsumedParamsBuffer(); return EPI; } @@ -3066,7 +3065,7 @@ public: return reinterpret_cast<const QualType *>(this+1); } param_type_iterator param_type_end() const { - return param_type_begin() + NumArgs; + return param_type_begin() + NumParams; } typedef const QualType *exception_iterator; @@ -3080,7 +3079,7 @@ public: return exception_begin() + NumExceptions; } - bool hasAnyConsumedParams() const { return HasAnyConsumedArgs; } + bool hasAnyConsumedParams() const { return HasAnyConsumedParams; } bool isParamConsumed(unsigned I) const { assert(I < getNumParams() && "parameter index out of range"); if (hasAnyConsumedParams()) diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index 21d6dcd5aae..8f51d0d4eee 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/include/clang/AST/TypeLoc.h @@ -1208,21 +1208,21 @@ public: } ArrayRef<ParmVarDecl *> getParams() const { - return ArrayRef<ParmVarDecl *>(getParmArray(), getNumArgs()); + return ArrayRef<ParmVarDecl *>(getParmArray(), getNumParams()); } - // ParmVarDecls* are stored after Info, one for each argument. + // ParmVarDecls* are stored after Info, one for each parameter. ParmVarDecl **getParmArray() const { return (ParmVarDecl**) getExtraLocalData(); } - unsigned getNumArgs() const { + unsigned getNumParams() const { if (isa<FunctionNoProtoType>(getTypePtr())) return 0; return cast<FunctionProtoType>(getTypePtr())->getNumParams(); } - ParmVarDecl *getArg(unsigned i) const { return getParmArray()[i]; } - void setArg(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; } + ParmVarDecl *getParam(unsigned i) const { return getParmArray()[i]; } + void setParam(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; } TypeLoc getResultLoc() const { return getInnerTypeLoc(); @@ -1237,14 +1237,14 @@ public: setLParenLoc(Loc); setRParenLoc(Loc); setLocalRangeEnd(Loc); - for (unsigned i = 0, e = getNumArgs(); i != e; ++i) - setArg(i, NULL); + for (unsigned i = 0, e = getNumParams(); i != e; ++i) + setParam(i, NULL); } /// \brief Returns the size of the type source info data block that is /// specific to this type. unsigned getExtraLocalDataSize() const { - return getNumArgs() * sizeof(ParmVarDecl*); + return getNumParams() * sizeof(ParmVarDecl *); } unsigned getExtraLocalDataAlignment() const { diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 65b18ff568d..084942baf65 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -7198,11 +7198,9 @@ public: /// GatherArgumentsForCall - Collector argument expressions for various /// form of call prototypes. - bool GatherArgumentsForCall(SourceLocation CallLoc, - FunctionDecl *FDecl, + bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, - unsigned FirstProtoArg, - ArrayRef<Expr *> Args, + unsigned FirstParam, ArrayRef<Expr *> Args, SmallVectorImpl<Expr *> &AllArgs, VariadicCallType CallType = VariadicDoesNotApply, bool AllowExplicit = false, diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 6988b8d6262..7665f32e673 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2895,7 +2895,7 @@ ASTContext::getFunctionType(QualType ResultTy, ArrayRef<QualType> ArgArray, } else if (EPI.ExceptionSpecType == EST_Unevaluated) { Size += sizeof(FunctionDecl*); } - if (EPI.ConsumedArguments) + if (EPI.ConsumedParameters) Size += NumArgs * sizeof(bool); FunctionProtoType *FTP = (FunctionProtoType*) Allocate(Size, TypeAlignment); @@ -7345,11 +7345,11 @@ bool ASTContext::FunctionTypesMatchOnNSConsumedAttrs( FromFunctionType->getExtProtoInfo(); FunctionProtoType::ExtProtoInfo ToEPI = ToFunctionType->getExtProtoInfo(); - if (FromEPI.ConsumedArguments && ToEPI.ConsumedArguments) + if (FromEPI.ConsumedParameters && ToEPI.ConsumedParameters) for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumParams(); ArgIdx != NumArgs; ++ArgIdx) { - if (FromEPI.ConsumedArguments[ArgIdx] != - ToEPI.ConsumedArguments[ArgIdx]) + if (FromEPI.ConsumedParameters[ArgIdx] != + ToEPI.ConsumedParameters[ArgIdx]) return false; } return true; diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index ec6f22609ad..e6776ac1b87 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -1631,7 +1631,7 @@ QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) { ToEPI.RefQualifier = FromEPI.RefQualifier; ToEPI.NumExceptions = ExceptionTypes.size(); ToEPI.Exceptions = ExceptionTypes.data(); - ToEPI.ConsumedArguments = FromEPI.ConsumedArguments; + ToEPI.ConsumedParameters = FromEPI.ConsumedParameters; ToEPI.ExceptionSpecType = FromEPI.ExceptionSpecType; ToEPI.NoexceptExpr = Importer.Import(FromEPI.NoexceptExpr); ToEPI.ExceptionSpecDecl = cast_or_null<FunctionDecl>( diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index caa7a4ad181..2eac8af2f11 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1585,41 +1585,37 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) { llvm_unreachable("Invalid calling convention."); } -FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args, +FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> params, QualType canonical, const ExtProtoInfo &epi) - : FunctionType(FunctionProto, result, epi.TypeQuals, - canonical, - result->isDependentType(), - result->isInstantiationDependentType(), - result->isVariablyModifiedType(), - result->containsUnexpandedParameterPack(), - epi.ExtInfo), - NumArgs(args.size()), NumExceptions(epi.NumExceptions), - ExceptionSpecType(epi.ExceptionSpecType), - HasAnyConsumedArgs(epi.ConsumedArguments != 0), - Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn), - RefQualifier(epi.RefQualifier) -{ - assert(NumArgs == args.size() && "function has too many parameters"); + : FunctionType(FunctionProto, result, epi.TypeQuals, canonical, + result->isDependentType(), + result->isInstantiationDependentType(), + result->isVariablyModifiedType(), + result->containsUnexpandedParameterPack(), epi.ExtInfo), + NumParams(params.size()), NumExceptions(epi.NumExceptions), + ExceptionSpecType(epi.ExceptionSpecType), + HasAnyConsumedParams(epi.ConsumedParameters != 0), Variadic(epi.Variadic), + HasTrailingReturn(epi.HasTrailingReturn), RefQualifier(epi.RefQualifier) { + assert(NumParams == params.size() && "function has too many parameters"); // Fill in the trailing argument array. QualType *argSlot = reinterpret_cast<QualType*>(this+1); - for (unsigned i = 0; i != NumArgs; ++i) { - if (args[i]->isDependentType()) + for (unsigned i = 0; i != NumParams; ++i) { + if (params[i]->isDependentType()) setDependent(); - else if (args[i]->isInstantiationDependentType()) + else if (params[i]->isInstantiationDependentType()) setInstantiationDependent(); - - if (args[i]->containsUnexpandedParameterPack()) + + if (params[i]->containsUnexpandedParameterPack()) setContainsUnexpandedParameterPack(); - argSlot[i] = args[i]; + argSlot[i] = params[i]; } if (getExceptionSpecType() == EST_Dynamic) { // Fill in the exception array. - QualType *exnSlot = argSlot + NumArgs; + QualType *exnSlot = argSlot + NumParams; for (unsigned i = 0, e = epi.NumExceptions; i != e; ++i) { if (epi.Exceptions[i]->isDependentType()) setDependent(); @@ -1633,7 +1629,7 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args, } } else if (getExceptionSpecType() == EST_ComputedNoexcept) { // Store the noexcept expression and context. - Expr **noexSlot = reinterpret_cast<Expr**>(argSlot + NumArgs); + Expr **noexSlot = reinterpret_cast<Expr **>(argSlot + NumParams); *noexSlot = epi.NoexceptExpr; if (epi.NoexceptExpr) { @@ -1646,7 +1642,8 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args, } else if (getExceptionSpecType() == EST_Uninstantiated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = reinterpret_cast<FunctionDecl**>(argSlot + NumArgs); + FunctionDecl **slot = + reinterpret_cast<FunctionDecl **>(argSlot + NumParams); slot[0] = epi.ExceptionSpecDecl; slot[1] = epi.ExceptionSpecTemplate; // This exception specification doesn't make the type dependent, because @@ -1654,14 +1651,15 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> args, } else if (getExceptionSpecType() == EST_Unevaluated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = reinterpret_cast<FunctionDecl**>(argSlot + NumArgs); + FunctionDecl **slot = + reinterpret_cast<FunctionDecl **>(argSlot + NumParams); slot[0] = epi.ExceptionSpecDecl; } - if (epi.ConsumedArguments) { - bool *consumedArgs = const_cast<bool *>(getConsumedParamsBuffer()); - for (unsigned i = 0; i != NumArgs; ++i) - consumedArgs[i] = epi.ConsumedArguments[i]; + if (epi.ConsumedParameters) { + bool *consumedParams = const_cast<bool *>(getConsumedParamsBuffer()); + for (unsigned i = 0; i != NumParams; ++i) + consumedParams[i] = epi.ConsumedParameters[i]; } } @@ -1723,7 +1721,7 @@ bool FunctionProtoType::isTemplateVariadic() const { } void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, - const QualType *ArgTys, unsigned NumArgs, + const QualType *ArgTys, unsigned NumParams, const ExtProtoInfo &epi, const ASTContext &Context) { @@ -1745,7 +1743,7 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, // whether the following bool is the EH spec or part of the arguments. ID.AddPointer(Result.getAsOpaquePtr()); - for (unsigned i = 0; i != NumArgs; ++i) + for (unsigned i = 0; i != NumParams; ++i) ID.AddPointer(ArgTys[i].getAsOpaquePtr()); // This method is relatively performance sensitive, so as a performance // shortcut, use one AddInteger call instead of four for the next four @@ -1768,9 +1766,9 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, epi.ExceptionSpecType == EST_Unevaluated) { ID.AddPointer(epi.ExceptionSpecDecl->getCanonicalDecl()); } - if (epi.ConsumedArguments) { - for (unsigned i = 0; i != NumArgs; ++i) - ID.AddBoolean(epi.ConsumedArguments[i]); + if (epi.ConsumedParameters) { + for (unsigned i = 0; i != NumParams; ++i) + ID.AddBoolean(epi.ConsumedParameters[i]); } epi.ExtInfo.Profile(ID); ID.AddBoolean(epi.HasTrailingReturn); @@ -1778,7 +1776,7 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) { - Profile(ID, getResultType(), param_type_begin(), NumArgs, getExtProtoInfo(), + Profile(ID, getResultType(), param_type_begin(), NumParams, getExtProtoInfo(), Ctx); } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index daef51e7be9..73a758db643 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -2212,20 +2212,20 @@ static std::string FormatFunctionParameter(ASTContext &Context, // Format the parameter list. std::string Params; - if (!BlockProto || Block.getNumArgs() == 0) { + if (!BlockProto || Block.getNumParams() == 0) { if (BlockProto && BlockProto.getTypePtr()->isVariadic()) Params = "(...)"; else Params = "(void)"; } else { Params += "("; - for (unsigned I = 0, N = Block.getNumArgs(); I != N; ++I) { + for (unsigned I = 0, N = Block.getNumParams(); I != N; ++I) { if (I) Params += ", "; - Params += FormatFunctionParameter(Context, Policy, Block.getArg(I), - /*SuppressName=*/false, + Params += FormatFunctionParameter(Context, Policy, Block.getParam(I), + /*SuppressName=*/false, /*SuppressBlock=*/true); - + if (I == N - 1 && BlockProto.getTypePtr()->isVariadic()) Params += ", ..."; } diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index df4d66eff62..39d71e20163 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4247,11 +4247,11 @@ struct CheckAbstractUsage { void Check(FunctionProtoTypeLoc TL, Sema::AbstractDiagSelID Sel) { Visit(TL.getResultLoc(), Sema::AbstractReturnType); - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) { - if (!TL.getArg(I)) + for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) { + if (!TL.getParam(I)) continue; - - TypeSourceInfo *TSI = TL.getArg(I)->getTypeSourceInfo(); + + TypeSourceInfo *TSI = TL.getParam(I)->getTypeSourceInfo(); if (TSI) Visit(TSI->getTypeLoc(), Sema::AbstractParamType); } } @@ -8545,7 +8545,7 @@ private: PD->setScopeInfo(0, I); PD->setImplicit(); ParamDecls.push_back(PD); - ProtoLoc.setArg(I, PD); + ProtoLoc.setParam(I, PD); } // Set up the new constructor. @@ -10637,11 +10637,11 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, const FunctionProtoType *Proto = Constructor->getType()->getAs<FunctionProtoType>(); assert(Proto && "Constructor without a prototype?"); - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = Proto->getNumParams(); // If too few arguments are available, we'll fill in the rest with defaults. - if (NumArgs < NumArgsInProto) - ConvertedArgs.reserve(NumArgsInProto); + if (NumArgs < NumParams) + ConvertedArgs.reserve(NumParams); else ConvertedArgs.reserve(NumArgs); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 6e27b76ba25..4d3eba73d78 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4017,9 +4017,9 @@ 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->getNumParams(); + unsigned NumParams = Proto->getNumParams(); bool Invalid = false; - unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumArgsInProto; + unsigned MinArgs = FDecl ? FDecl->getMinRequiredArguments() : NumParams; unsigned FnKind = Fn->getType()->isBlockPointerType() ? 1 /* block */ : (IsExecConfig ? 3 /* kernel function (exec config) */ @@ -4027,7 +4027,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, // If too few arguments are available (and we don't have default // arguments for the remaining parameters), don't make the call. - if (Args.size() < NumArgsInProto) { + if (Args.size() < NumParams) { if (Args.size() < MinArgs) { MemberExpr *ME = dyn_cast<MemberExpr>(Fn); TypoCorrection TC; @@ -4037,25 +4037,24 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, : Fn->getLocStart())), Args))) { unsigned diag_id = - MinArgs == NumArgsInProto && !Proto->isVariadic() + MinArgs == NumParams && !Proto->isVariadic() ? diag::err_typecheck_call_too_few_args_suggest : diag::err_typecheck_call_too_few_args_at_least_suggest; diagnoseTypo(TC, PDiag(diag_id) << FnKind << MinArgs << static_cast<unsigned>(Args.size()) << Fn->getSourceRange()); } else if (MinArgs == 1 && FDecl && FDecl->getParamDecl(0)->getDeclName()) - Diag(RParenLoc, MinArgs == NumArgsInProto && !Proto->isVariadic() - ? diag::err_typecheck_call_too_few_args_one - : diag::err_typecheck_call_too_few_args_at_least_one) - << FnKind - << FDecl->getParamDecl(0) << Fn->getSourceRange(); + Diag(RParenLoc, + MinArgs == NumParams && !Proto->isVariadic() + ? diag::err_typecheck_call_too_few_args_one + : diag::err_typecheck_call_too_few_args_at_least_one) + << FnKind << FDecl->getParamDecl(0) << Fn->getSourceRange(); else - Diag(RParenLoc, MinArgs == NumArgsInProto && !Proto->isVariadic() - ? diag::err_typecheck_call_too_few_args - : diag::err_typecheck_call_too_few_args_at_least) - << FnKind - << MinArgs << static_cast<unsigned>(Args.size()) - << Fn->getSourceRange(); + Diag(RParenLoc, MinArgs == NumParams && !Proto->isVariadic() + ? diag::err_typecheck_call_too_few_args + : diag::err_typecheck_call_too_few_args_at_least) + << FnKind << MinArgs << static_cast<unsigned>(Args.size()) + << Fn->getSourceRange(); // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) @@ -4064,12 +4063,12 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, return true; } - Call->setNumArgs(Context, NumArgsInProto); + Call->setNumArgs(Context, NumParams); } // If too many are passed and not variadic, error on the extras and drop // them. - if (Args.size() > NumArgsInProto) { + if (Args.size() > NumParams) { if (!Proto->isVariadic()) { TypoCorrection TC; if (FDecl && (TC = TryTypoCorrectionForCall( @@ -4077,33 +4076,31 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, Fn->getLocStart()), Args))) { unsigned diag_id = - MinArgs == NumArgsInProto && !Proto->isVariadic() + MinArgs == NumParams && !Proto->isVariadic() ? diag::err_typecheck_call_too_many_args_suggest : diag::err_typecheck_call_too_many_args_at_most_suggest; - diagnoseTypo(TC, PDiag(diag_id) << FnKind << NumArgsInProto + diagnoseTypo(TC, PDiag(diag_id) << FnKind << NumParams << static_cast<unsigned>(Args.size()) << Fn->getSourceRange()); - } else if (NumArgsInProto == 1 && FDecl && + } else if (NumParams == 1 && FDecl && FDecl->getParamDecl(0)->getDeclName()) - Diag(Args[NumArgsInProto]->getLocStart(), - MinArgs == NumArgsInProto - ? diag::err_typecheck_call_too_many_args_one - : diag::err_typecheck_call_too_many_args_at_most_one) - << FnKind - << FDecl->getParamDecl(0) << static_cast<unsigned>(Args.size()) - << Fn->getSourceRange() - << SourceRange(Args[NumArgsInProto]->getLocStart(), - Args.back()->getLocEnd()); + Diag(Args[NumParams]->getLocStart(), + MinArgs == NumParams + ? diag::err_typecheck_call_too_many_args_one + : diag::err_typecheck_call_too_many_args_at_most_one) + << FnKind << FDecl->getParamDecl(0) + << static_cast<unsigned>(Args.size()) << Fn->getSourceRange() + << SourceRange(Args[NumParams]->getLocStart(), + Args.back()->getLocEnd()); else - Diag(Args[NumArgsInProto]->getLocStart(), - MinArgs == NumArgsInProto - ? diag::err_typecheck_call_too_many_args - : diag::err_typecheck_call_too_many_args_at_most) - << FnKind - << NumArgsInProto << static_cast<unsigned>(Args.size()) - << Fn->getSourceRange() - << SourceRange(Args[NumArgsInProto]->getLocStart(), - Args.back()->getLocEnd()); + Diag(Args[NumParams]->getLocStart(), + MinArgs == NumParams + ? diag::err_typecheck_call_too_many_args + : diag::err_typecheck_call_too_many_args_at_most) + << FnKind << NumParams << static_cast<unsigned>(Args.size()) + << Fn->getSourceRange() + << SourceRange(Args[NumParams]->getLocStart(), + Args.back()->getLocEnd()); // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) @@ -4111,7 +4108,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, << FDecl; // This deletes the extra arguments. - Call->setNumArgs(Context, NumArgsInProto); + Call->setNumArgs(Context, NumParams); return true; } } @@ -4129,24 +4126,21 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, return false; } -bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, - FunctionDecl *FDecl, +bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, - unsigned FirstProtoArg, - ArrayRef<Expr *> Args, + unsigned FirstParam, ArrayRef<Expr *> Args, SmallVectorImpl<Expr *> &AllArgs, - VariadicCallType CallType, - bool AllowExplicit, + VariadicCallType CallType, bool AllowExplicit, bool IsListInitialization) { - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = Proto->getNumParams(); unsigned NumArgsToCheck = Args.size(); bool Invalid = false; - if (Args.size() != NumArgsInProto) + if (Args.size() != NumParams) // Use default arguments for missing arguments - NumArgsToCheck = NumArgsInProto; + NumArgsToCheck = NumParams; unsigned ArgIx = 0; // Continue to check argument types (even if we have too few/many args). - for (unsigned i = FirstProtoArg; i != NumArgsToCheck; i++) { + for (unsigned i = FirstParam; i != NumArgsToCheck; i++) { QualType ProtoArgType = Proto->getParamType(i); Expr *Arg; @@ -10342,8 +10336,8 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, // Push block parameters from the declarator if we had them. SmallVector<ParmVarDecl*, 8> Params; if (ExplicitSignature) { - for (unsigned I = 0, E = ExplicitSignature.getNumArgs(); I != E; ++I) { - ParmVarDecl *Param = ExplicitSignature.getArg(I); + for (unsigned I = 0, E = ExplicitSignature.getNumParams(); I != E; ++I) { + ParmVarDecl *Param = ExplicitSignature.getParam(I); if (Param->getIdentifier() == 0 && !Param->isImplicit() && !Param->isInvalidDecl() && diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 5481676ab63..2023c1f61e3 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -1245,8 +1245,8 @@ static void addFunctionPointerConversion(Sema &S, From->getTypeSourceInfo(), From->getStorageClass(), /*DefaultArg=*/0)); - CallOpConvTL.setArg(I, From); - CallOpConvNameTL.setArg(I, From); + CallOpConvTL.setParam(I, From); + CallOpConvNameTL.setParam(I, From); } CXXConversionDecl *Conversion diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index bbe68a14a67..d3c2b36a4fd 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -5562,12 +5562,12 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, Candidate.IgnoreObjectArgument = false; Candidate.ExplicitCallArguments = Args.size(); - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = 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 // list (8.3.5). - if ((Args.size() + (PartialOverloading && Args.size())) > NumArgsInProto && + if ((Args.size() + (PartialOverloading && Args.size())) > NumParams && !Proto->isVariadic()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_too_many_arguments; @@ -5599,7 +5599,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, // Determine the implicit conversion sequences for each of the // arguments. for (unsigned ArgIdx = 0; ArgIdx < Args.size(); ++ArgIdx) { - if (ArgIdx < NumArgsInProto) { + if (ArgIdx < NumParams) { // (C++ 13.3.2p3): for F to be a viable function, there shall // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding @@ -5805,12 +5805,12 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, Candidate.IgnoreObjectArgument = false; Candidate.ExplicitCallArguments = Args.size(); - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = 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 // list (8.3.5). - if (Args.size() > NumArgsInProto && !Proto->isVariadic()) { + if (Args.size() > NumParams && !Proto->isVariadic()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_too_many_arguments; return; @@ -5850,7 +5850,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, // Determine the implicit conversion sequences for each of the // arguments. for (unsigned ArgIdx = 0; ArgIdx < Args.size(); ++ArgIdx) { - if (ArgIdx < NumArgsInProto) { + if (ArgIdx < NumParams) { // (C++ 13.3.2p3): for F to be a viable function, there shall // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding @@ -6287,12 +6287,12 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion(); // Find the - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = 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 // list (8.3.5). - if (Args.size() > NumArgsInProto && !Proto->isVariadic()) { + if (Args.size() > NumParams && !Proto->isVariadic()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_too_many_arguments; return; @@ -6300,7 +6300,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, // Function types don't have any default arguments, so just check if // we have enough arguments. - if (Args.size() < NumArgsInProto) { + if (Args.size() < NumParams) { // Not enough arguments. Candidate.Viable = false; Candidate.FailureKind = ovl_fail_too_few_arguments; @@ -6310,7 +6310,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, // Determine the implicit conversion sequences for each of the // arguments. for (unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) { - if (ArgIdx < NumArgsInProto) { + if (ArgIdx < NumParams) { // (C++ 13.3.2p3): for F to be a viable function, there shall // exist for each argument an implicit conversion sequence // (13.3.3.1) that converts that argument to the corresponding @@ -9356,9 +9356,9 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, } // Fill in the rest of the conversions. - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = Proto->getNumParams(); for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) { - if (ArgIdx < NumArgsInProto) { + if (ArgIdx < NumParams) { Cand->Conversions[ConvIdx] = TryCopyInitialization( S, Args[ArgIdx], Proto->getParamType(ArgIdx), SuppressUserConversions, /*InOverloadResolution=*/true, @@ -11684,7 +11684,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, const FunctionProtoType *Proto = Method->getType()->getAs<FunctionProtoType>(); - unsigned NumArgsInProto = Proto->getNumParams(); + unsigned NumParams = Proto->getNumParams(); DeclarationNameInfo OpLocInfo( Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc); @@ -11720,8 +11720,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, // We may have default arguments. If so, we need to allocate more // slots in the call for them. - if (Args.size() < NumArgsInProto) - TheCall->setNumArgs(Context, NumArgsInProto + 1); + if (Args.size() < NumParams) + TheCall->setNumArgs(Context, NumParams + 1); bool IsError = false; @@ -11736,7 +11736,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, TheCall->setArg(0, Object.take()); // Check the argument types. - for (unsigned i = 0; i != NumArgsInProto; i++) { + for (unsigned i = 0; i != NumParams; i++) { Expr *Arg; if (i < Args.size()) { Arg = Args[i]; @@ -11768,7 +11768,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, // If this is a variadic call, handle args passed through "...". if (Proto->isVariadic()) { // Promote the arguments (C99 6.5.2.2p7). - for (unsigned i = NumArgsInProto, e = Args.size(); i < e; i++) { + for (unsigned i = NumParams, e = Args.size(); i < e; i++) { ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod, 0); IsError |= Arg.isInvalid(); TheCall->setArg(i + 1, Arg.take()); diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 2424e6fb84e..efd53cff180 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1638,8 +1638,8 @@ static bool NeedsInstantiationAsFunctionType(TypeSourceInfo *T) { return false; FunctionProtoTypeLoc FP = TL.castAs<FunctionProtoTypeLoc>(); - for (unsigned I = 0, E = FP.getNumArgs(); I != E; ++I) { - ParmVarDecl *P = FP.getArg(I); + for (unsigned I = 0, E = FP.getNumParams(); I != E; ++I) { + ParmVarDecl *P = FP.getParam(I); // This must be synthesized from a typedef. if (!P) continue; diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index bd8f5d30934..438798433c1 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2933,9 +2933,9 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, TypeLoc NewTL = NewTInfo->getTypeLoc().IgnoreParens(); FunctionProtoTypeLoc NewProtoLoc = NewTL.castAs<FunctionProtoTypeLoc>(); unsigned NewIdx = 0; - for (unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumArgs(); + for (unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams(); OldIdx != NumOldParams; ++OldIdx) { - ParmVarDecl *OldParam = OldProtoLoc.getArg(OldIdx); + ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx); LocalInstantiationScope *Scope = SemaRef.CurrentInstantiationScope; Optional<unsigned> NumArgumentsInExpansion; @@ -2946,14 +2946,14 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, if (!NumArgumentsInExpansion) { // Simple case: normal parameter, or a parameter pack that's // instantiated to a (still-dependent) parameter pack. - ParmVarDecl *NewParam = NewProtoLoc.getArg(NewIdx++); + ParmVarDecl *NewParam = NewProtoLoc.getParam(NewIdx++); Params.push_back(NewParam); Scope->InstantiatedLocal(OldParam, NewParam); } else { // Parameter pack expansion: make the instantiation an argument pack. Scope->MakeInstantiatedLocalArgPack(OldParam); for (unsigned I = 0; I != *NumArgumentsInExpansion; ++I) { - ParmVarDecl *NewParam = NewProtoLoc.getArg(NewIdx++); + ParmVarDecl *NewParam = NewProtoLoc.getParam(NewIdx++); Params.push_back(NewParam); Scope->InstantiatedLocalPackArg(OldParam, NewParam); } @@ -2965,8 +2965,9 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, // the function parameters themselves. const FunctionProtoType *OldProto = cast<FunctionProtoType>(OldProtoLoc.getType()); - for (unsigned i = 0, i_end = OldProtoLoc.getNumArgs(); i != i_end; ++i) { - ParmVarDecl *OldParam = OldProtoLoc.getArg(i); + for (unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end; + ++i) { + ParmVarDecl *OldParam = OldProtoLoc.getParam(i); if (!OldParam) { Params.push_back(SemaRef.BuildParmVarDeclForTypedef( D, D->getLocation(), OldProto->getParamType(i))); diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index a84cad19aec..4b3e6023cf5 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2877,9 +2877,9 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, SmallVector<QualType, 16> ArgTys; ArgTys.reserve(FTI.NumArgs); - SmallVector<bool, 16> ConsumedArguments; - ConsumedArguments.reserve(FTI.NumArgs); - bool HasAnyConsumedArguments = false; + SmallVector<bool, 16> ConsumedParameters; + ConsumedParameters.reserve(FTI.NumArgs); + bool HasAnyConsumedParameters = false; for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) { ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[i].Param); @@ -2940,15 +2940,15 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, if (LangOpts.ObjCAutoRefCount) { bool Consumed = Param->hasAttr<NSConsumedAttr>(); - ConsumedArguments.push_back(Consumed); - HasAnyConsumedArguments |= Consumed; + ConsumedParameters.push_back(Consumed); + HasAnyConsumedParameters |= Consumed; } ArgTys.push_back(ArgTy); } - if (HasAnyConsumedArguments) - EPI.ConsumedArguments = ConsumedArguments.data(); + if (HasAnyConsumedParameters) + EPI.ConsumedParameters = ConsumedParameters.data(); SmallVector<QualType, 4> Exceptions; SmallVector<ParsedType, 2> DynamicExceptions; @@ -3715,9 +3715,9 @@ namespace { const DeclaratorChunk::FunctionTypeInfo &FTI = Chunk.Fun; TL.setLParenLoc(FTI.getLParenLoc()); TL.setRParenLoc(FTI.getRParenLoc()); - for (unsigned i = 0, e = TL.getNumArgs(), tpi = 0; i != e; ++i) { + for (unsigned i = 0, e = TL.getNumParams(), tpi = 0; i != e; ++i) { ParmVarDecl *Param = cast<ParmVarDecl>(FTI.ArgInfo[i].Param); - TL.setArg(tpi++, Param); + TL.setParam(tpi++, Param); } // FIXME: exception specs } diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 97f4a4f4548..787581d35be 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -4357,7 +4357,7 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, if (T->hasTrailingReturn()) { if (getDerived().TransformFunctionTypeParams( - TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(), + TL.getBeginLoc(), TL.getParmArray(), TL.getNumParams(), TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls)) return QualType(); @@ -4381,7 +4381,7 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, return QualType(); if (getDerived().TransformFunctionTypeParams( - TL.getBeginLoc(), TL.getParmArray(), TL.getNumArgs(), + TL.getBeginLoc(), TL.getParmArray(), TL.getNumParams(), TL.getTypePtr()->param_type_begin(), ParamTypes, &ParamDecls)) return QualType(); } @@ -4404,8 +4404,8 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, NewTL.setLParenLoc(TL.getLParenLoc()); NewTL.setRParenLoc(TL.getRParenLoc()); NewTL.setLocalRangeEnd(TL.getLocalRangeEnd()); - for (unsigned i = 0, e = NewTL.getNumArgs(); i != e; ++i) - NewTL.setArg(i, ParamDecls[i]); + for (unsigned i = 0, e = NewTL.getNumParams(); i != e; ++i) + NewTL.setParam(i, ParamDecls[i]); return Result; } @@ -8276,7 +8276,7 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) { FunctionProtoTypeLoc NewCallOpFPTL = NewCallOpTSI->getTypeLoc().castAs<FunctionProtoTypeLoc>(); ParmVarDecl **NewParamDeclArray = NewCallOpFPTL.getParmArray(); - const unsigned NewNumArgs = NewCallOpFPTL.getNumArgs(); + const unsigned NewNumArgs = NewCallOpFPTL.getNumParams(); for (unsigned I = 0; I < NewNumArgs; ++I) { // If this call operator's type does not require transformation, diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 76f62f5e71a..10a182fe9e8 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -5077,8 +5077,8 @@ void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) { TL.setLParenLoc(ReadSourceLocation(Record, Idx)); TL.setRParenLoc(ReadSourceLocation(Record, Idx)); TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx)); - for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) { - TL.setArg(i, ReadDeclAs<ParmVarDecl>(Record, Idx)); + for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) { + TL.setParam(i, ReadDeclAs<ParmVarDecl>(Record, Idx)); } } void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) { diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 14b163facaa..5760e38bb40 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -512,8 +512,8 @@ void TypeLocWriter::VisitFunctionTypeLoc(FunctionTypeLoc TL) { Writer.AddSourceLocation(TL.getLParenLoc(), Record); Writer.AddSourceLocation(TL.getRParenLoc(), Record); Writer.AddSourceLocation(TL.getLocalRangeEnd(), Record); - for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) - Writer.AddDeclRef(TL.getArg(i), Record); + for (unsigned i = 0, e = TL.getNumParams(); i != e; ++i) + Writer.AddDeclRef(TL.getParam(i), Record); } void TypeLocWriter::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) { VisitFunctionTypeLoc(TL); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 3719c56cb10..62f58c93d9a 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -1520,8 +1520,8 @@ bool CursorVisitor::VisitFunctionTypeLoc(FunctionTypeLoc TL, if (!SkipResultType && Visit(TL.getResultLoc())) return true; - for (unsigned I = 0, N = TL.getNumArgs(); I != N; ++I) - if (Decl *D = TL.getArg(I)) + for (unsigned I = 0, N = TL.getNumParams(); I != N; ++I) + if (Decl *D = TL.getParam(I)) if (Visit(MakeCXCursor(D, TU, RegionOfInterest))) return true; @@ -2437,8 +2437,8 @@ bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) { TL.getAs<FunctionProtoTypeLoc>()) { if (E->hasExplicitParameters()) { // Visit parameters. - for (unsigned I = 0, N = Proto.getNumArgs(); I != N; ++I) - if (Visit(MakeCXCursor(Proto.getArg(I), TU))) + for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I) + if (Visit(MakeCXCursor(Proto.getParam(I), TU))) return true; } else { // Visit result type. |