forked from OSchip/llvm-project
Use even more ArrayRefs
No functional change is intended, just a small refactoring. llvm-svn: 273650
This commit is contained in:
parent
e2129a3ee9
commit
a3debed239
|
@ -1429,9 +1429,8 @@ DEF_TRAVERSE_DECL(ObjCMethodDecl, {
|
|||
if (D->getReturnTypeSourceInfo()) {
|
||||
TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
|
||||
}
|
||||
for (ObjCMethodDecl::param_iterator I = D->param_begin(), E = D->param_end();
|
||||
I != E; ++I) {
|
||||
TRY_TO(TraverseDecl(*I));
|
||||
for (ParmVarDecl *Parameter : D->parameters()) {
|
||||
TRY_TO(TraverseDecl(Parameter));
|
||||
}
|
||||
if (D->isThisDeclarationADefinition()) {
|
||||
TRY_TO(TraverseStmt(D->getBody()));
|
||||
|
@ -1832,10 +1831,8 @@ bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *D) {
|
|||
// if the traverser is visiting implicit code. Parameter variable
|
||||
// declarations do not have valid TypeSourceInfo, so to visit them
|
||||
// we need to traverse the declarations explicitly.
|
||||
for (FunctionDecl::param_const_iterator I = D->param_begin(),
|
||||
E = D->param_end();
|
||||
I != E; ++I)
|
||||
TRY_TO(TraverseDecl(*I));
|
||||
for (ParmVarDecl *Parameter : D->parameters())
|
||||
TRY_TO(TraverseDecl(Parameter));
|
||||
}
|
||||
|
||||
if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
|
||||
|
|
|
@ -400,8 +400,8 @@ public:
|
|||
const FunctionDecl *FD) {
|
||||
if (!prototype->isVariadic()) return All;
|
||||
if (FD)
|
||||
additional += std::count_if(FD->param_begin(), FD->param_end(),
|
||||
[](const ParmVarDecl *PVD) {
|
||||
additional +=
|
||||
llvm::count_if(FD->parameters(), [](const ParmVarDecl *PVD) {
|
||||
return PVD->hasAttr<PassObjectSizeAttr>();
|
||||
});
|
||||
return RequiredArgs(prototype->getNumParams() + additional);
|
||||
|
|
|
@ -1154,10 +1154,8 @@ void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) {
|
|||
if (!D->param_begin() && D->getNumParams())
|
||||
dumpChild([=] { OS << "<<NULL params x " << D->getNumParams() << ">>"; });
|
||||
else
|
||||
for (FunctionDecl::param_const_iterator I = D->param_begin(),
|
||||
E = D->param_end();
|
||||
I != E; ++I)
|
||||
dumpDecl(*I);
|
||||
for (const ParmVarDecl *Parameter : D->parameters())
|
||||
dumpDecl(Parameter);
|
||||
|
||||
if (const CXXConstructorDecl *C = dyn_cast<CXXConstructorDecl>(D))
|
||||
for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
|
||||
|
@ -1548,10 +1546,8 @@ void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
|
|||
if (D->isThisDeclarationADefinition()) {
|
||||
dumpDeclContext(D);
|
||||
} else {
|
||||
for (ObjCMethodDecl::param_const_iterator I = D->param_begin(),
|
||||
E = D->param_end();
|
||||
I != E; ++I)
|
||||
dumpDecl(*I);
|
||||
for (const ParmVarDecl *Parameter : D->parameters())
|
||||
dumpDecl(Parameter);
|
||||
}
|
||||
|
||||
if (D->isVariadic())
|
||||
|
|
|
@ -290,13 +290,12 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
|
|||
// Print the parameters.
|
||||
Out << "(";
|
||||
bool PrintComma = false;
|
||||
for (FunctionDecl::param_const_iterator I = D->param_begin(),
|
||||
E = D->param_end(); I != E; ++I) {
|
||||
for (ParmVarDecl *Parameter : D->parameters()) {
|
||||
if (PrintComma)
|
||||
Out << ", ";
|
||||
else
|
||||
PrintComma = true;
|
||||
Out << **I;
|
||||
Out << *Parameter;
|
||||
}
|
||||
Out << ")";
|
||||
|
||||
|
@ -320,13 +319,12 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
|
|||
// Print the parameters.
|
||||
Out << "(";
|
||||
bool PrintComma = false;
|
||||
for (FunctionDecl::param_const_iterator I = D->param_begin(),
|
||||
E = D->param_end(); I != E; ++I) {
|
||||
for (ParmVarDecl *Parameter : D->parameters()) {
|
||||
if (PrintComma)
|
||||
Out << ", ";
|
||||
else
|
||||
PrintComma = true;
|
||||
Out << **I;
|
||||
Out << *Parameter;
|
||||
}
|
||||
Out << ")";
|
||||
|
||||
|
|
|
@ -2961,11 +2961,11 @@ bool Sema::SemaBuiltinVAStartImpl(CallExpr *TheCall) {
|
|||
// Get the last formal in the current function.
|
||||
const ParmVarDecl *LastArg;
|
||||
if (CurBlock)
|
||||
LastArg = *(CurBlock->TheDecl->param_end()-1);
|
||||
LastArg = CurBlock->TheDecl->parameters().back();
|
||||
else if (FunctionDecl *FD = getCurFunctionDecl())
|
||||
LastArg = *(FD->param_end()-1);
|
||||
LastArg = FD->parameters().back();
|
||||
else
|
||||
LastArg = *(getCurMethodDecl()->param_end()-1);
|
||||
LastArg = getCurMethodDecl()->parameters().back();
|
||||
SecondArgIsLastNamedArgument = PV == LastArg;
|
||||
|
||||
Type = PV->getType();
|
||||
|
@ -8499,7 +8499,7 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
|
|||
}
|
||||
|
||||
if (const auto *FD = dyn_cast<FunctionDecl>(PV->getDeclContext())) {
|
||||
auto ParamIter = std::find(FD->param_begin(), FD->param_end(), PV);
|
||||
auto ParamIter = llvm::find(FD->parameters(), PV);
|
||||
assert(ParamIter != FD->param_end());
|
||||
unsigned ParamNo = std::distance(FD->param_begin(), ParamIter);
|
||||
|
||||
|
|
|
@ -1150,7 +1150,7 @@ static void addFunctionPointerConversion(Sema &S,
|
|||
CXXMethodDecl *CallOperator) {
|
||||
// This conversion is explicitly disabled if the lambda's function has
|
||||
// pass_object_size attributes on any of its parameters.
|
||||
if (std::any_of(CallOperator->param_begin(), CallOperator->param_end(),
|
||||
if (llvm::any_of(CallOperator->parameters(),
|
||||
std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>)))
|
||||
return;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ using namespace clang;
|
|||
using namespace sema;
|
||||
|
||||
static bool functionHasPassObjectSizeParams(const FunctionDecl *FD) {
|
||||
return std::any_of(FD->param_begin(), FD->param_end(),
|
||||
return llvm::any_of(FD->parameters(),
|
||||
std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>));
|
||||
}
|
||||
|
||||
|
@ -8935,8 +8935,8 @@ static bool checkAddressOfFunctionIsAvailable(Sema &S, const FunctionDecl *FD,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto I = std::find_if(FD->param_begin(), FD->param_end(),
|
||||
std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>));
|
||||
auto I = llvm::find_if(
|
||||
FD->parameters(), std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>));
|
||||
if (I == FD->param_end())
|
||||
return true;
|
||||
|
||||
|
|
|
@ -1019,9 +1019,8 @@ void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
|
|||
Record.AddStmt(D->getBody());
|
||||
Record.AddTypeSourceInfo(D->getSignatureAsWritten());
|
||||
Record.push_back(D->param_size());
|
||||
for (FunctionDecl::param_iterator P = D->param_begin(), PEnd = D->param_end();
|
||||
P != PEnd; ++P)
|
||||
Record.AddDeclRef(*P);
|
||||
for (ParmVarDecl *P : D->parameters())
|
||||
Record.AddDeclRef(P);
|
||||
Record.push_back(D->isVariadic());
|
||||
Record.push_back(D->blockMissingReturnType());
|
||||
Record.push_back(D->isConversionFromLambda());
|
||||
|
|
Loading…
Reference in New Issue