From 6f83a9e0dcff8f63f19c3c7ba14656d75fcee250 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Wed, 26 Feb 2014 22:27:52 +0000 Subject: [PATCH] argument -> parameter terminology fixes for FunctionTypeInfo This is a continuation of r199686. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202307 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/DeclSpec.h | 45 +++++++++++++++++------------------ lib/Parse/ParseDecl.cpp | 4 ++-- lib/Parse/ParseDeclCXX.cpp | 13 +++++----- lib/Parse/Parser.cpp | 8 +++---- lib/Sema/DeclSpec.cpp | 28 +++++++++++----------- lib/Sema/SemaDecl.cpp | 39 +++++++++++++++--------------- lib/Sema/SemaDeclCXX.cpp | 22 ++++++++--------- lib/Sema/SemaLambda.cpp | 10 ++++---- lib/Sema/SemaType.cpp | 40 +++++++++++++++---------------- 9 files changed, 103 insertions(+), 106 deletions(-) diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 7cafdf850a..53c18d98ae 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -1115,7 +1115,8 @@ struct DeclaratorChunk { }; /// ParamInfo - An array of paraminfo objects is allocated whenever a function - /// declarator is parsed. There are two interesting styles of arguments here: + /// declarator is parsed. There are two interesting styles of parameters + /// here: /// K&R-style identifier lists and parameter type lists. K&R-style identifier /// lists will have information about the identifier, but no type information. /// Parameter type lists will have type info (if the actions module provides @@ -1147,7 +1148,7 @@ struct DeclaratorChunk { struct FunctionTypeInfo : TypeInfoCommon { /// hasPrototype - This is true if the function had at least one typed - /// argument. If the function is () or (a,b,c), then it has no prototype, + /// parameter. If the function is () or (a,b,c), then it has no prototype, /// and is treated as a K&R-style function. unsigned hasPrototype : 1; @@ -1170,8 +1171,8 @@ struct DeclaratorChunk { /// ExceptionSpecType - An ExceptionSpecificationType value. unsigned ExceptionSpecType : 3; - /// DeleteArgInfo - If this is true, we need to delete[] ArgInfo. - unsigned DeleteArgInfo : 1; + /// DeleteParams - If this is true, we need to delete[] Params. + unsigned DeleteParams : 1; /// HasTrailingReturnType - If this is true, a trailing return type was /// specified. @@ -1186,9 +1187,9 @@ struct DeclaratorChunk { /// The location of the right parenthesis in the source. unsigned RParenLoc; - /// NumArgs - This is the number of formal arguments provided for the + /// NumParams - This is the number of formal parameters specified by the /// declarator. - unsigned NumArgs; + unsigned NumParams; /// NumExceptions - This is the number of types in the dynamic-exception- /// decl, if the function has one. @@ -1216,10 +1217,10 @@ struct DeclaratorChunk { /// \brief The location of the keyword introducing the spec, if any. unsigned ExceptionSpecLoc; - /// ArgInfo - This is a pointer to a new[]'d array of ParamInfo objects that - /// describe the arguments for this function declarator. This is null if - /// there are no arguments specified. - ParamInfo *ArgInfo; + /// Params - This is a pointer to a new[]'d array of ParamInfo objects that + /// describe the parameters specified by this function declarator. null if + /// there are no parameters specified. + ParamInfo *Params; union { /// \brief Pointer to a new[]'d array of TypeAndRange objects that @@ -1236,30 +1237,28 @@ struct DeclaratorChunk { /// type specified. UnionParsedType TrailingReturnType; - /// \brief Reset the argument list to having zero arguments. + /// \brief Reset the parameter list to having zero parameters. /// /// This is used in various places for error recovery. - void freeArgs() { - if (DeleteArgInfo) { - delete[] ArgInfo; - DeleteArgInfo = false; + void freeParams() { + if (DeleteParams) { + delete[] Params; + DeleteParams = false; } - NumArgs = 0; + NumParams = 0; } void destroy() { - if (DeleteArgInfo) - delete[] ArgInfo; + if (DeleteParams) + delete[] Params; if (getExceptionSpecType() == EST_Dynamic) delete[] Exceptions; } /// isKNRPrototype - Return true if this is a K&R style identifier list, /// like "void foo(a,b,c)". In a function definition, this will be followed - /// by the argument type definitions. - bool isKNRPrototype() const { - return !hasPrototype && NumArgs != 0; - } + /// by the parameter type definitions. + bool isKNRPrototype() const { return !hasPrototype && NumParams != 0; } SourceLocation getLParenLoc() const { return SourceLocation::getFromRawEncoding(LParenLoc); @@ -1428,7 +1427,7 @@ struct DeclaratorChunk { static DeclaratorChunk getFunction(bool hasProto, bool isAmbiguous, SourceLocation LParenLoc, - ParamInfo *ArgInfo, unsigned NumArgs, + ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, unsigned TypeQuals, diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 8efbc3db39..8417c27ce8 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -308,8 +308,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName, PrototypeScope.reset(new ParseScope(this, Scope::FunctionPrototypeScope | Scope::FunctionDeclarationScope | Scope::DeclScope)); - for (unsigned i = 0; i != FTI.NumArgs; ++i) { - ParmVarDecl *Param = cast(FTI.ArgInfo[i].Param); + for (unsigned i = 0; i != FTI.NumParams; ++i) { + ParmVarDecl *Param = cast(FTI.Params[i].Param); Actions.ActOnReenterCXXMethodParameter(getCurScope(), Param); } } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index b95eb87a6f..7d198efa2e 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1776,8 +1776,8 @@ void Parser::HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo, DeclaratorChunk::FunctionTypeInfo &FTI = DeclaratorInfo.getFunctionTypeInfo(); - for (unsigned ParamIdx = 0; ParamIdx < FTI.NumArgs; ++ParamIdx) { - if (LateMethod || FTI.ArgInfo[ParamIdx].DefaultArgTokens) { + for (unsigned ParamIdx = 0; ParamIdx < FTI.NumParams; ++ParamIdx) { + if (LateMethod || FTI.Params[ParamIdx].DefaultArgTokens) { if (!LateMethod) { // Push this method onto the stack of late-parsed method // declarations. @@ -1787,17 +1787,16 @@ void Parser::HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo, // Add all of the parameters prior to this one (they don't // have default arguments). - LateMethod->DefaultArgs.reserve(FTI.NumArgs); + LateMethod->DefaultArgs.reserve(FTI.NumParams); for (unsigned I = 0; I < ParamIdx; ++I) LateMethod->DefaultArgs.push_back( - LateParsedDefaultArgument(FTI.ArgInfo[I].Param)); + LateParsedDefaultArgument(FTI.Params[I].Param)); } // Add this parameter to the list of parameters (it may or may // not have a default argument). - LateMethod->DefaultArgs.push_back( - LateParsedDefaultArgument(FTI.ArgInfo[ParamIdx].Param, - FTI.ArgInfo[ParamIdx].DefaultArgTokens)); + LateMethod->DefaultArgs.push_back(LateParsedDefaultArgument( + FTI.Params[ParamIdx].Param, FTI.Params[ParamIdx].DefaultArgTokens)); } } } diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index b76d430f17..8b96e025b4 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1179,20 +1179,20 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) { for (unsigned i = 0; ; ++i) { // C99 6.9.1p6: those declarators shall declare only identifiers from // the identifier list. - if (i == FTI.NumArgs) { + if (i == FTI.NumParams) { Diag(ParmDeclarator.getIdentifierLoc(), diag::err_no_matching_param) << ParmDeclarator.getIdentifier(); break; } - if (FTI.ArgInfo[i].Ident == ParmDeclarator.getIdentifier()) { + if (FTI.Params[i].Ident == ParmDeclarator.getIdentifier()) { // Reject redefinitions of parameters. - if (FTI.ArgInfo[i].Param) { + if (FTI.Params[i].Param) { Diag(ParmDeclarator.getIdentifierLoc(), diag::err_param_redefinition) << ParmDeclarator.getIdentifier(); } else { - FTI.ArgInfo[i].Param = Param; + FTI.Params[i].Param = Param; } break; } diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 0b512ccf1c..5c2006f6e9 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -149,8 +149,8 @@ CXXScopeSpec::getWithLocInContext(ASTContext &Context) const { DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isAmbiguous, SourceLocation LParenLoc, - ParamInfo *ArgInfo, - unsigned NumArgs, + ParamInfo *Params, + unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, unsigned TypeQuals, @@ -185,10 +185,10 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, I.Fun.LParenLoc = LParenLoc.getRawEncoding(); I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding(); I.Fun.RParenLoc = RParenLoc.getRawEncoding(); - I.Fun.DeleteArgInfo = false; + I.Fun.DeleteParams = false; I.Fun.TypeQuals = TypeQuals; - I.Fun.NumArgs = NumArgs; - I.Fun.ArgInfo = 0; + I.Fun.NumParams = NumParams; + I.Fun.Params = 0; I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef; I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding(); I.Fun.ConstQualifierLoc = ConstQualifierLoc.getRawEncoding(); @@ -203,22 +203,22 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, TrailingReturnType.isInvalid(); I.Fun.TrailingReturnType = TrailingReturnType.get(); - // new[] an argument array if needed. - if (NumArgs) { + // new[] a parameter array if needed. + if (NumParams) { // If the 'InlineParams' in Declarator is unused and big enough, put our // parameter list there (in an effort to avoid new/delete traffic). If it // is already used (consider a function returning a function pointer) or too - // small (function taking too many arguments), go to the heap. + // small (function with too many parameters), go to the heap. if (!TheDeclarator.InlineParamsUsed && - NumArgs <= llvm::array_lengthof(TheDeclarator.InlineParams)) { - I.Fun.ArgInfo = TheDeclarator.InlineParams; - I.Fun.DeleteArgInfo = false; + NumParams <= llvm::array_lengthof(TheDeclarator.InlineParams)) { + I.Fun.Params = TheDeclarator.InlineParams; + I.Fun.DeleteParams = false; TheDeclarator.InlineParamsUsed = true; } else { - I.Fun.ArgInfo = new DeclaratorChunk::ParamInfo[NumArgs]; - I.Fun.DeleteArgInfo = true; + I.Fun.Params = new DeclaratorChunk::ParamInfo[NumParams]; + I.Fun.DeleteParams = true; } - memcpy(I.Fun.ArgInfo, ArgInfo, sizeof(ArgInfo[0])*NumArgs); + memcpy(I.Fun.Params, Params, sizeof(Params[0]) * NumParams); } // Check what exception specification information we should actually store. diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 601c16109f..69dd4905cb 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6890,13 +6890,13 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // single void argument. // We let through "const void" here because Sema::GetTypeForDeclarator // already checks for that case. - if (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 && - FTI.ArgInfo[0].Param && - cast(FTI.ArgInfo[0].Param)->getType()->isVoidType()) { + if (FTI.NumParams == 1 && !FTI.isVariadic && FTI.Params[0].Ident == 0 && + FTI.Params[0].Param && + cast(FTI.Params[0].Param)->getType()->isVoidType()) { // Empty arg list, don't push any params. - } else if (FTI.NumArgs > 0 && FTI.ArgInfo[0].Param != 0) { - for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) { - ParmVarDecl *Param = cast(FTI.ArgInfo[i].Param); + } else if (FTI.NumParams > 0 && FTI.Params[0].Param != 0) { + for (unsigned i = 0, e = FTI.NumParams; i != e; ++i) { + ParmVarDecl *Param = cast(FTI.Params[i].Param); assert(Param->getDeclContext() != NewFD && "Was set before ?"); Param->setDeclContext(NewFD); Params.push_back(Param); @@ -9340,16 +9340,15 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, // Verify 6.9.1p6: 'every identifier in the identifier list shall be declared' // for a K&R function. if (!FTI.hasPrototype) { - for (int i = FTI.NumArgs; i != 0; /* decrement in loop */) { + for (int i = FTI.NumParams; i != 0; /* decrement in loop */) { --i; - if (FTI.ArgInfo[i].Param == 0) { + if (FTI.Params[i].Param == 0) { SmallString<256> Code; - llvm::raw_svector_ostream(Code) << " int " - << FTI.ArgInfo[i].Ident->getName() - << ";\n"; - Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared) - << FTI.ArgInfo[i].Ident - << FixItHint::CreateInsertion(LocAfterDecls, Code.str()); + llvm::raw_svector_ostream(Code) + << " int " << FTI.Params[i].Ident->getName() << ";\n"; + Diag(FTI.Params[i].IdentLoc, diag::ext_param_not_declared) + << FTI.Params[i].Ident + << FixItHint::CreateInsertion(LocAfterDecls, Code.str()); // Implicitly declare the argument as type 'int' for lack of a better // type. @@ -9357,14 +9356,14 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, DeclSpec DS(attrs); const char* PrevSpec; // unused unsigned DiagID; // unused - DS.SetTypeSpecType(DeclSpec::TST_int, FTI.ArgInfo[i].IdentLoc, - PrevSpec, DiagID, Context.getPrintingPolicy()); + DS.SetTypeSpecType(DeclSpec::TST_int, FTI.Params[i].IdentLoc, PrevSpec, + DiagID, Context.getPrintingPolicy()); // Use the identifier location for the type source range. - DS.SetRangeStart(FTI.ArgInfo[i].IdentLoc); - DS.SetRangeEnd(FTI.ArgInfo[i].IdentLoc); + DS.SetRangeStart(FTI.Params[i].IdentLoc); + DS.SetRangeEnd(FTI.Params[i].IdentLoc); Declarator ParamD(DS, Declarator::KNRTypeListContext); - ParamD.SetIdentifier(FTI.ArgInfo[i].Ident, FTI.ArgInfo[i].IdentLoc); - FTI.ArgInfo[i].Param = ActOnParamDeclarator(S, ParamD); + ParamD.SetIdentifier(FTI.Params[i].Ident, FTI.Params[i].IdentLoc); + FTI.Params[i].Param = ActOnParamDeclarator(S, ParamD); } } } diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 210ad28aca..b9c7cca326 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -380,16 +380,16 @@ void Sema::CheckExtraCXXDefaultArguments(Declarator &D) { MightBeFunction = false; continue; } - for (unsigned argIdx = 0, e = chunk.Fun.NumArgs; argIdx != e; ++argIdx) { - ParmVarDecl *Param = - cast(chunk.Fun.ArgInfo[argIdx].Param); + for (unsigned argIdx = 0, e = chunk.Fun.NumParams; argIdx != e; + ++argIdx) { + ParmVarDecl *Param = cast(chunk.Fun.Params[argIdx].Param); if (Param->hasUnparsedDefaultArg()) { - CachedTokens *Toks = chunk.Fun.ArgInfo[argIdx].DefaultArgTokens; + CachedTokens *Toks = chunk.Fun.Params[argIdx].DefaultArgTokens; Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc) << SourceRange((*Toks)[1].getLocation(), Toks->back().getLocation()); delete Toks; - chunk.Fun.ArgInfo[argIdx].DefaultArgTokens = 0; + chunk.Fun.Params[argIdx].DefaultArgTokens = 0; } else if (Param->getDefaultArg()) { Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc) << Param->getDefaultArg()->getSourceRange(); @@ -6294,9 +6294,9 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) { static inline bool FTIHasSingleVoidArgument(DeclaratorChunk::FunctionTypeInfo &FTI) { - return (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 && - FTI.ArgInfo[0].Param && - cast(FTI.ArgInfo[0].Param)->getType()->isVoidType()); + return (FTI.NumParams == 1 && !FTI.isVariadic && FTI.Params[0].Ident == 0 && + FTI.Params[0].Param && + cast(FTI.Params[0].Param)->getType()->isVoidType()); } /// CheckDestructorDeclarator - Called by ActOnDeclarator to check @@ -6377,11 +6377,11 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R, } // Make sure we don't have any parameters. - if (FTI.NumArgs > 0 && !FTIHasSingleVoidArgument(FTI)) { + if (FTI.NumParams > 0 && !FTIHasSingleVoidArgument(FTI)) { Diag(D.getIdentifierLoc(), diag::err_destructor_with_params); // Delete the parameters. - FTI.freeArgs(); + FTI.freeParams(); D.setInvalidType(); } @@ -6451,7 +6451,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, Diag(D.getIdentifierLoc(), diag::err_conv_function_with_params); // Delete the parameters. - D.getFunctionTypeInfo().freeArgs(); + D.getFunctionTypeInfo().freeParams(); D.setInvalidType(); } else if (Proto->isVariadic()) { Diag(D.getIdentifierLoc(), diag::err_conv_function_variadic); diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 0e10bfdf6f..9b45071687 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -898,13 +898,13 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, ExplicitResultType = FTI.hasTrailingReturnType(); - if (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 && - cast(FTI.ArgInfo[0].Param)->getType()->isVoidType()) { + if (FTI.NumParams == 1 && !FTI.isVariadic && FTI.Params[0].Ident == 0 && + cast(FTI.Params[0].Param)->getType()->isVoidType()) { // Empty arg list, don't push any params. } else { - Params.reserve(FTI.NumArgs); - for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) - Params.push_back(cast(FTI.ArgInfo[i].Param)); + Params.reserve(FTI.NumParams); + for (unsigned i = 0, e = FTI.NumParams; i != e; ++i) + Params.push_back(cast(FTI.Params[i].Param)); } // Check for unexpanded parameter packs in the method type. diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 99493aeb16..a0153dc2e8 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -2343,11 +2343,11 @@ static void warnAboutAmbiguousFunction(Sema &S, Declarator &D, return; // An initializer for a non-class type can have at most one argument. - if (!RT->isRecordType() && FTI.NumArgs > 1) + if (!RT->isRecordType() && FTI.NumParams > 1) return; // An initializer for a reference must have exactly one argument. - if (RT->isReferenceType() && FTI.NumArgs != 1) + if (RT->isReferenceType() && FTI.NumParams != 1) return; // Only warn if this declarator is declaring a function at block scope, and @@ -2367,9 +2367,9 @@ static void warnAboutAmbiguousFunction(Sema &S, Declarator &D, SourceRange ParenRange(DeclType.Loc, DeclType.EndLoc); S.Diag(DeclType.Loc, - FTI.NumArgs ? diag::warn_parens_disambiguated_as_function_declaration - : diag::warn_empty_parens_are_function_decl) - << ParenRange; + FTI.NumParams ? diag::warn_parens_disambiguated_as_function_declaration + : diag::warn_empty_parens_are_function_decl) + << ParenRange; // If the declaration looks like: // T var1, @@ -2390,11 +2390,11 @@ static void warnAboutAmbiguousFunction(Sema &S, Declarator &D, } } - if (FTI.NumArgs > 0) { + if (FTI.NumParams > 0) { // For a declaration with parameters, eg. "T var(T());", suggest adding parens // around the first parameter to turn the declaration into a variable // declaration. - SourceRange Range = FTI.ArgInfo[0].Param->getSourceRange(); + SourceRange Range = FTI.Params[0].Param->getSourceRange(); SourceLocation B = Range.getBegin(); SourceLocation E = S.PP.getLocForEndOfToken(Range.getEnd()); // FIXME: Maybe we should suggest adding braces instead of parens @@ -2851,14 +2851,14 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, FunctionType::ExtInfo EI(getCCForDeclaratorChunk(S, D, FTI, chunkIndex)); - if (!FTI.NumArgs && !FTI.isVariadic && !LangOpts.CPlusPlus) { + if (!FTI.NumParams && !FTI.isVariadic && !LangOpts.CPlusPlus) { // Simple void foo(), where the incoming T is the result type. T = Context.getFunctionNoProtoType(T, EI); } else { // We allow a zero-parameter variadic function in C if the // function is marked with the "overloadable" attribute. Scan // for this attribute now. - if (!FTI.NumArgs && FTI.isVariadic && !LangOpts.CPlusPlus) { + if (!FTI.NumParams && FTI.isVariadic && !LangOpts.CPlusPlus) { bool Overloadable = false; for (const AttributeList *Attrs = D.getAttributes(); Attrs; Attrs = Attrs->getNext()) { @@ -2872,10 +2872,11 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, S.Diag(FTI.getEllipsisLoc(), diag::err_ellipsis_first_arg); } - if (FTI.NumArgs && FTI.ArgInfo[0].Param == 0) { + if (FTI.NumParams && FTI.Params[0].Param == 0) { // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function // definition. - S.Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration); + S.Diag(FTI.Params[0].IdentLoc, + diag::err_ident_list_in_fn_declaration); D.setInvalidType(true); // Recover by creating a K&R-style function type. T = Context.getFunctionNoProtoType(T, EI); @@ -2894,14 +2895,14 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // Otherwise, we have a function with an argument list that is // potentially variadic. SmallVector ArgTys; - ArgTys.reserve(FTI.NumArgs); + ArgTys.reserve(FTI.NumParams); SmallVector ConsumedParameters; - ConsumedParameters.reserve(FTI.NumArgs); + ConsumedParameters.reserve(FTI.NumParams); bool HasAnyConsumedParameters = false; - for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) { - ParmVarDecl *Param = cast(FTI.ArgInfo[i].Param); + for (unsigned i = 0, e = FTI.NumParams; i != e; ++i) { + ParmVarDecl *Param = cast(FTI.Params[i].Param); QualType ArgTy = Param->getType(); assert(!ArgTy.isNull() && "Couldn't parse type?"); @@ -2912,14 +2913,13 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // If this is something like 'float(int, void)', reject it. 'void' // is an incomplete type (C99 6.2.5p19) and function decls cannot // have arguments of incomplete type. - if (FTI.NumArgs != 1 || FTI.isVariadic) { + if (FTI.NumParams != 1 || FTI.isVariadic) { S.Diag(DeclType.Loc, diag::err_void_only_param); ArgTy = Context.IntTy; Param->setType(ArgTy); - } else if (FTI.ArgInfo[i].Ident) { + } else if (FTI.Params[i].Ident) { // Reject, but continue to parse 'int(void abc)'. - S.Diag(FTI.ArgInfo[i].IdentLoc, - diag::err_param_with_void_type); + S.Diag(FTI.Params[i].IdentLoc, diag::err_param_with_void_type); ArgTy = Context.IntTy; Param->setType(ArgTy); } else { @@ -3735,7 +3735,7 @@ namespace { TL.setLParenLoc(FTI.getLParenLoc()); TL.setRParenLoc(FTI.getRParenLoc()); for (unsigned i = 0, e = TL.getNumParams(), tpi = 0; i != e; ++i) { - ParmVarDecl *Param = cast(FTI.ArgInfo[i].Param); + ParmVarDecl *Param = cast(FTI.Params[i].Param); TL.setParam(tpi++, Param); } // FIXME: exception specs -- 2.40.0