From bea522ff43a3f11c7a2bc7949119dbb9fce19e39 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Fri, 8 Mar 2013 21:51:21 +0000 Subject: ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType. No (intended) functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Type.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/AST/Type.cpp') diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index e6687a7717..f6fcab52eb 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1560,8 +1560,8 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) { llvm_unreachable("Invalid calling convention."); } -FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, - unsigned numArgs, QualType canonical, +FunctionProtoType::FunctionProtoType(QualType result, ArrayRef args, + QualType canonical, const ExtProtoInfo &epi) : FunctionType(FunctionProto, result, epi.TypeQuals, canonical, @@ -1570,17 +1570,17 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, result->isVariablyModifiedType(), result->containsUnexpandedParameterPack(), epi.ExtInfo), - NumArgs(numArgs), NumExceptions(epi.NumExceptions), + NumArgs(args.size()), NumExceptions(epi.NumExceptions), ExceptionSpecType(epi.ExceptionSpecType), HasAnyConsumedArgs(epi.ConsumedArguments != 0), Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn), RefQualifier(epi.RefQualifier) { - assert(NumArgs == numArgs && "function has too many parameters"); + assert(NumArgs == args.size() && "function has too many parameters"); // Fill in the trailing argument array. QualType *argSlot = reinterpret_cast(this+1); - for (unsigned i = 0; i != numArgs; ++i) { + for (unsigned i = 0; i != NumArgs; ++i) { if (args[i]->isDependentType()) setDependent(); else if (args[i]->isInstantiationDependentType()) @@ -1594,7 +1594,7 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, if (getExceptionSpecType() == EST_Dynamic) { // Fill in the exception array. - QualType *exnSlot = argSlot + numArgs; + QualType *exnSlot = argSlot + NumArgs; for (unsigned i = 0, e = epi.NumExceptions; i != e; ++i) { if (epi.Exceptions[i]->isDependentType()) setDependent(); @@ -1608,7 +1608,7 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, } } else if (getExceptionSpecType() == EST_ComputedNoexcept) { // Store the noexcept expression and context. - Expr **noexSlot = reinterpret_cast(argSlot + numArgs); + Expr **noexSlot = reinterpret_cast(argSlot + NumArgs); *noexSlot = epi.NoexceptExpr; if (epi.NoexceptExpr) { @@ -1621,7 +1621,7 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, } else if (getExceptionSpecType() == EST_Uninstantiated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = reinterpret_cast(argSlot + numArgs); + FunctionDecl **slot = reinterpret_cast(argSlot + NumArgs); slot[0] = epi.ExceptionSpecDecl; slot[1] = epi.ExceptionSpecTemplate; // This exception specification doesn't make the type dependent, because @@ -1629,13 +1629,13 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args, } else if (getExceptionSpecType() == EST_Unevaluated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = reinterpret_cast(argSlot + numArgs); + FunctionDecl **slot = reinterpret_cast(argSlot + NumArgs); slot[0] = epi.ExceptionSpecDecl; } if (epi.ConsumedArguments) { bool *consumedArgs = const_cast(getConsumedArgsBuffer()); - for (unsigned i = 0; i != numArgs; ++i) + for (unsigned i = 0; i != NumArgs; ++i) consumedArgs[i] = epi.ConsumedArguments[i]; } } -- cgit v1.2.3-18-g5258