diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-06-24 04:05:48 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-24 04:05:48 +0000 |
commit | 59f779213626990295f21b93d3f18f432513da34 (patch) | |
tree | cc77755b71dc773d2a39a20a94ba8336e3d1891c /clang/lib/AST | |
parent | f440d267e3e391b25bea2980d13f849f1fffeb99 (diff) | |
download | bcm5719-llvm-59f779213626990295f21b93d3f18f432513da34.tar.gz bcm5719-llvm-59f779213626990295f21b93d3f18f432513da34.zip |
Use more ArrayRefs
No functional change is intended, just a small refactoring.
llvm-svn: 273647
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/ASTDumper.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/Comment.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/Decl.cpp | 17 | ||||
-rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 2 |
7 files changed, 22 insertions, 21 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 5fc7877322c..572cebc6814 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -5164,7 +5164,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { SourceLocation Loc; CharUnits PtrSize = getTypeSizeInChars(VoidPtrTy); CharUnits ParmOffset = PtrSize; - for (auto PI : Decl->params()) { + for (auto PI : Decl->parameters()) { QualType PType = PI->getType(); CharUnits sz = getObjCEncodingTypeSize(PType); if (sz.isZero()) @@ -5179,7 +5179,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { // Argument types. ParmOffset = PtrSize; - for (auto PVDecl : Decl->params()) { + for (auto PVDecl : Decl->parameters()) { QualType PType = PVDecl->getOriginalType(); if (const ArrayType *AT = dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { @@ -5207,7 +5207,7 @@ bool ASTContext::getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, getObjCEncodingForType(Decl->getReturnType(), S); CharUnits ParmOffset; // Compute size of all parameters. - for (auto PI : Decl->params()) { + for (auto PI : Decl->parameters()) { QualType PType = PI->getType(); CharUnits sz = getObjCEncodingTypeSize(PType); if (sz.isZero()) @@ -5221,7 +5221,7 @@ bool ASTContext::getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, ParmOffset = CharUnits::Zero(); // Argument types. - for (auto PVDecl : Decl->params()) { + for (auto PVDecl : Decl->parameters()) { QualType PType = PVDecl->getOriginalType(); if (const ArrayType *AT = dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index da7e980c5a4..e1d52eaf0d9 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -1681,7 +1681,7 @@ void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { } void ASTDumper::VisitBlockDecl(const BlockDecl *D) { - for (auto I : D->params()) + for (auto I : D->parameters()) dumpDecl(I); if (D->isVariadic()) diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 9a4e4a2894d..4f799264811 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -3010,7 +3010,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { // Import the function parameters. SmallVector<ParmVarDecl *, 8> Parameters; - for (auto P : D->params()) { + for (auto P : D->parameters()) { ParmVarDecl *ToP = cast_or_null<ParmVarDecl>(Importer.Import(P)); if (!ToP) return nullptr; @@ -3276,7 +3276,7 @@ Decl *ASTNodeImporter::VisitIndirectFieldDecl(IndirectFieldDecl *D) { IndirectFieldDecl *ToIndirectField = IndirectFieldDecl::Create( Importer.getToContext(), DC, Loc, Name.getAsIdentifierInfo(), T, - NamedChain, D->getChainingSize()); + {NamedChain, D->getChainingSize()}); for (const auto *Attr : D->attrs()) ToIndirectField->addAttr(Attr->clone(Importer.getToContext())); @@ -3619,7 +3619,7 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) { // Import the parameters SmallVector<ParmVarDecl *, 5> ToParams; - for (auto *FromP : D->params()) { + for (auto *FromP : D->parameters()) { ParmVarDecl *ToP = cast_or_null<ParmVarDecl>(Importer.Import(FromP)); if (!ToP) return nullptr; diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp index d05c5de543f..893bdc5c17b 100644 --- a/clang/lib/AST/Comment.cpp +++ b/clang/lib/AST/Comment.cpp @@ -157,7 +157,7 @@ void DeclInfo::fill() { case Decl::CXXConversion: { const FunctionDecl *FD = cast<FunctionDecl>(CommentDecl); Kind = FunctionKind; - ParamVars = llvm::makeArrayRef(FD->param_begin(), FD->getNumParams()); + ParamVars = FD->parameters(); ReturnType = FD->getReturnType(); unsigned NumLists = FD->getNumTemplateParameterLists(); if (NumLists != 0) { @@ -177,7 +177,7 @@ void DeclInfo::fill() { case Decl::ObjCMethod: { const ObjCMethodDecl *MD = cast<ObjCMethodDecl>(CommentDecl); Kind = FunctionKind; - ParamVars = llvm::makeArrayRef(MD->param_begin(), MD->param_size()); + ParamVars = MD->parameters(); ReturnType = MD->getReturnType(); IsObjCMethod = true; IsInstanceMethod = MD->isInstanceMethod(); @@ -189,7 +189,7 @@ void DeclInfo::fill() { Kind = FunctionKind; TemplateKind = Template; const FunctionDecl *FD = FTD->getTemplatedDecl(); - ParamVars = llvm::makeArrayRef(FD->param_begin(), FD->getNumParams()); + ParamVars = FD->parameters(); ReturnType = FD->getReturnType(); TemplateParameters = FTD->getTemplateParameters(); break; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 09ba90a3ea0..d59c4b422b3 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2793,7 +2793,7 @@ unsigned FunctionDecl::getMinRequiredArguments() const { return getNumParams(); unsigned NumRequiredArgs = 0; - for (auto *Param : params()) + for (auto *Param : parameters()) if (!Param->isParameterPack() && !Param->hasDefaultArg()) ++NumRequiredArgs; return NumRequiredArgs; @@ -4099,8 +4099,10 @@ void IndirectFieldDecl::anchor() { } IndirectFieldDecl::IndirectFieldDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, - QualType T, NamedDecl **CH, unsigned CHS) - : ValueDecl(IndirectField, DC, L, N, T), Chaining(CH), ChainingSize(CHS) { + QualType T, + MutableArrayRef<NamedDecl *> CH) + : ValueDecl(IndirectField, DC, L, N, T), Chaining(CH.data()), + ChainingSize(CH.size()) { // In C++, indirect field declarations conflict with tag declarations in the // same scope, so add them to IDNS_Tag so that tag redeclaration finds them. if (C.getLangOpts().CPlusPlus) @@ -4109,16 +4111,15 @@ IndirectFieldDecl::IndirectFieldDecl(ASTContext &C, DeclContext *DC, IndirectFieldDecl * IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, NamedDecl **CH, - unsigned CHS) { - return new (C, DC) IndirectFieldDecl(C, DC, L, Id, T, CH, CHS); + IdentifierInfo *Id, QualType T, + llvm::MutableArrayRef<NamedDecl *> CH) { + return new (C, DC) IndirectFieldDecl(C, DC, L, Id, T, CH); } IndirectFieldDecl *IndirectFieldDecl::CreateDeserialized(ASTContext &C, unsigned ID) { return new (C, ID) IndirectFieldDecl(C, nullptr, SourceLocation(), - DeclarationName(), QualType(), nullptr, - 0); + DeclarationName(), QualType(), None); } SourceRange EnumConstantDecl::getSourceRange() const { diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 9d76f65b62a..6868ea2a6d7 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -1055,7 +1055,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) { std::string name = OMD->getSelector().getAsString(); std::string::size_type pos, lastPos = 0; - for (const auto *PI : OMD->params()) { + for (const auto *PI : OMD->parameters()) { // FIXME: selector is missing here! pos = name.find_first_of(':', lastPos); Out << " " << name.substr(lastPos, pos - lastPos) << ':'; diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index d5b7e108395..311187b4b39 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -2054,7 +2054,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) { OS << " ("; CXXMethodDecl *Method = Node->getCallOperator(); NeedComma = false; - for (auto P : Method->params()) { + for (auto P : Method->parameters()) { if (NeedComma) { OS << ", "; } else { |