Author: rnk Date: Mon Jun 10 15:51:09 2013 New Revision: 183694 URL: http://llvm.org/viewvc/llvm-project?rev=183694&view=rev Log: Use FPT::getArgTypes() instead of manually building ArrayRefs
Made significantly easier with git-clang-format. Differential Revision: http://llvm-reviews.chandlerc.com/D947 Modified: cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/lib/AST/LambdaMangleContext.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaExceptionSpec.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaLambda.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/trunk/lib/Sema/SemaType.cpp Modified: cfe/trunk/lib/AST/ASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/AST/ASTContext.cpp (original) +++ cfe/trunk/lib/AST/ASTContext.cpp Mon Jun 10 15:51:09 2013 @@ -2074,10 +2074,7 @@ const FunctionType *ASTContext::adjustFu const FunctionProtoType *FPT = cast<FunctionProtoType>(T); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExtInfo = Info; - Result = getFunctionType(FPT->getResultType(), - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI); + Result = getFunctionType(FPT->getResultType(), FPT->getArgTypes(), EPI); } return cast<FunctionType>(Result.getTypePtr()); @@ -7039,10 +7036,7 @@ QualType ASTContext::mergeFunctionTypes( FunctionProtoType::ExtProtoInfo EPI = proto->getExtProtoInfo(); EPI.ExtInfo = einfo; - return getFunctionType(retType, - ArrayRef<QualType>(proto->arg_type_begin(), - proto->getNumArgs()), - EPI); + return getFunctionType(retType, proto->getArgTypes(), EPI); } if (allLTypes) return lhs; @@ -7390,11 +7384,8 @@ QualType ASTContext::mergeObjCGCQualifie if (const FunctionProtoType *FPT = cast<FunctionProtoType>(F)) { FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExtInfo = getFunctionExtInfo(LHS); - QualType ResultType - = getFunctionType(OldReturnType, - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI); + QualType ResultType = + getFunctionType(OldReturnType, FPT->getArgTypes(), EPI); return ResultType; } } Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Jun 10 15:51:09 2013 @@ -2664,10 +2664,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl FromEPI.NoexceptExpr) { FunctionProtoType::ExtProtoInfo DefaultEPI; FromTy = Importer.getFromContext().getFunctionType( - FromFPT->getResultType(), - ArrayRef<QualType>(FromFPT->arg_type_begin(), - FromFPT->getNumArgs()), - DefaultEPI); + FromFPT->getResultType(), FromFPT->getArgTypes(), DefaultEPI); usedDifferentExceptionSpec = true; } } Modified: cfe/trunk/lib/AST/LambdaMangleContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/LambdaMangleContext.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/AST/LambdaMangleContext.cpp (original) +++ cfe/trunk/lib/AST/LambdaMangleContext.cpp Mon Jun 10 15:51:09 2013 @@ -22,12 +22,9 @@ unsigned LambdaMangleContext::getManglin const FunctionProtoType *Proto = CallOperator->getType()->getAs<FunctionProtoType>(); ASTContext &Context = CallOperator->getASTContext(); - - QualType Key = - Context.getFunctionType(Context.VoidTy, - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - FunctionProtoType::ExtProtoInfo()); + + QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(), + FunctionProtoType::ExtProtoInfo()); Key = Context.getCanonicalType(Key); return ++ManglingNumbers[Key->castAs<FunctionProtoType>()]; } Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jun 10 15:51:09 2013 @@ -5907,10 +5907,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, T = Context.getObjCObjectPointerType(T); if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(R)) { FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); - R = Context.getFunctionType(T, - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI); + R = Context.getFunctionType(T, FPT->getArgTypes(), EPI); } else if (isa<FunctionNoProtoType>(R)) R = Context.getFunctionNoProtoType(T); @@ -6209,9 +6206,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExceptionSpecType = EST_BasicNoexcept; NewFD->setType(Context.getFunctionType(FPT->getResultType(), - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI)); + FPT->getArgTypes(), EPI)); } } @@ -6804,9 +6799,7 @@ bool Sema::CheckFunctionDeclaration(Scop FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; MD->setType(Context.getFunctionType(FPT->getResultType(), - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI)); + FPT->getArgTypes(), 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. Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original) +++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Jun 10 15:51:09 2013 @@ -203,11 +203,8 @@ bool Sema::CheckEquivalentExceptionSpec( Old->isExternC()) { FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_DynamicNone; - QualType NewType = - Context.getFunctionType(NewProto->getResultType(), - ArrayRef<QualType>(NewProto->arg_type_begin(), - NewProto->getNumArgs()), - EPI); + QualType NewType = Context.getFunctionType(NewProto->getResultType(), + NewProto->getArgTypes(), EPI); New->setType(NewType); return false; } @@ -228,11 +225,8 @@ bool Sema::CheckEquivalentExceptionSpec( // Update the type of the function with the appropriate exception // specification. - QualType NewType = - Context.getFunctionType(NewProto->getResultType(), - ArrayRef<QualType>(NewProto->arg_type_begin(), - NewProto->getNumArgs()), - EPI); + QualType NewType = Context.getFunctionType(NewProto->getResultType(), + NewProto->getArgTypes(), EPI); New->setType(NewType); // If exceptions are disabled, suppress the warning about missing Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jun 10 15:51:09 2013 @@ -10027,11 +10027,7 @@ ExprResult Sema::ActOnBlockStmtExpr(Sour FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals = 0; // FIXME: silently? EPI.ExtInfo = Ext; - BlockTy = - Context.getFunctionType(RetTy, - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), - EPI); + BlockTy = Context.getFunctionType(RetTy, FPT->getArgTypes(), EPI); } // If we don't have a function type, just build one from nothing. @@ -12200,11 +12196,8 @@ ExprResult RebuildUnknownAnyExpr::VisitC // Rebuild the function type, replacing the result type with DestType. if (const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FnType)) - DestType = - S.Context.getFunctionType(DestType, - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - Proto->getExtProtoInfo()); + DestType = S.Context.getFunctionType(DestType, Proto->getArgTypes(), + Proto->getExtProtoInfo()); else DestType = S.Context.getFunctionNoProtoType(DestType, FnType->getExtInfo()); Modified: cfe/trunk/lib/Sema/SemaLambda.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaLambda.cpp (original) +++ cfe/trunk/lib/Sema/SemaLambda.cpp Mon Jun 10 15:51:09 2013 @@ -811,11 +811,8 @@ static void addFunctionPointerConversion { FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo(); ExtInfo.TypeQuals = 0; - FunctionTy = - S.Context.getFunctionType(Proto->getResultType(), - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - ExtInfo); + FunctionTy = S.Context.getFunctionType(Proto->getResultType(), + Proto->getArgTypes(), ExtInfo); FunctionPtrTy = S.Context.getPointerType(FunctionTy); } @@ -883,11 +880,8 @@ static void addBlockPointerConversion(Se { FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo(); ExtInfo.TypeQuals = 0; - QualType FunctionTy - = S.Context.getFunctionType(Proto->getResultType(), - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - ExtInfo); + QualType FunctionTy = S.Context.getFunctionType( + Proto->getResultType(), Proto->getArgTypes(), ExtInfo); BlockPtrTy = S.Context.getBlockPointerType(FunctionTy); } @@ -1010,11 +1004,8 @@ ExprResult Sema::ActOnLambdaExpr(SourceL // Create a function type with the inferred return type. const FunctionProtoType *Proto = CallOperator->getType()->getAs<FunctionProtoType>(); - QualType FunctionTy - = Context.getFunctionType(LSI->ReturnType, - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - Proto->getExtProtoInfo()); + QualType FunctionTy = Context.getFunctionType( + LSI->ReturnType, Proto->getArgTypes(), Proto->getExtProtoInfo()); CallOperator->setType(FunctionTy); } Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Jun 10 15:51:09 2013 @@ -5950,9 +5950,7 @@ Sema::CheckFunctionTemplateSpecializatio const FunctionProtoType *FPT = FT->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; - FT = Context.getFunctionType(FPT->getResultType(), - ArrayRef<QualType>(FPT->arg_type_begin(), - FPT->getNumArgs()), + FT = Context.getFunctionType(FPT->getResultType(), FPT->getArgTypes(), EPI); } } Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Jun 10 15:51:09 2013 @@ -1143,9 +1143,7 @@ static QualType adjustFunctionTypeForIns FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo(); NewEPI.ExtInfo = OrigFunc->getExtInfo(); return Context.getFunctionType(NewFunc->getResultType(), - ArrayRef<QualType>(NewFunc->arg_type_begin(), - NewFunc->getNumArgs()), - NewEPI); + NewFunc->getArgTypes(), NewEPI); } /// Normal class members are of more specific types and therefore @@ -2680,9 +2678,7 @@ static void InstantiateExceptionSpec(Sem EPI.NoexceptExpr = NoexceptExpr; New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(), - ArrayRef<QualType>(NewProto->arg_type_begin(), - NewProto->getNumArgs()), - EPI)); + NewProto->getArgTypes(), EPI)); } void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, @@ -2699,9 +2695,7 @@ void Sema::InstantiateExceptionSpec(Sour FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_None; Decl->setType(Context.getFunctionType(Proto->getResultType(), - ArrayRef<QualType>(Proto->arg_type_begin(), - Proto->getNumArgs()), - EPI)); + Proto->getArgTypes(), EPI)); return; } @@ -2780,10 +2774,8 @@ TemplateDeclInstantiator::InitFunctionIn EPI.ExceptionSpecType = NewEST; EPI.ExceptionSpecDecl = New; EPI.ExceptionSpecTemplate = ExceptionSpecTemplate; - New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(), - ArrayRef<QualType>(NewProto->arg_type_begin(), - NewProto->getNumArgs()), - EPI)); + New->setType(SemaRef.Context.getFunctionType( + NewProto->getResultType(), NewProto->getArgTypes(), EPI)); } else { ::InstantiateExceptionSpec(SemaRef, New, Proto, TemplateArgs); } Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=183694&r1=183693&r2=183694&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Jun 10 15:51:09 2013 @@ -3034,9 +3034,7 @@ static TypeSourceInfo *GetFullTypeForDec EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - T = Context.getFunctionType(FnTy->getResultType(), - ArrayRef<QualType>(FnTy->arg_type_begin(), - FnTy->getNumArgs()), + T = Context.getFunctionType(FnTy->getResultType(), FnTy->getArgTypes(), EPI); // Rebuild any parens around the identifier in the function type. for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
