Skip to content

Commit a3c248d

Browse files
Move from llvm::makeArrayRef to ArrayRef deduction guides - clang/ part
This is a follow-up to https://reviews.llvm.org/D140896, split into several parts as it touches a lot of files. Differential Revision: https://reviews.llvm.org/D141139
1 parent 5b24d42 commit a3c248d

File tree

138 files changed

+563
-637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+563
-637
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,7 @@ class IndirectFieldDecl : public ValueDecl,
32053205
using chain_iterator = ArrayRef<NamedDecl *>::const_iterator;
32063206

32073207
ArrayRef<NamedDecl *> chain() const {
3208-
return llvm::makeArrayRef(Chaining, ChainingSize);
3208+
return llvm::ArrayRef(Chaining, ChainingSize);
32093209
}
32103210
chain_iterator chain_begin() const { return chain().begin(); }
32113211
chain_iterator chain_end() const { return chain().end(); }

clang/include/clang/AST/DeclCXX.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ class CXXRecordDecl : public RecordDecl {
357357
}
358358

359359
ArrayRef<CXXBaseSpecifier> bases() const {
360-
return llvm::makeArrayRef(getBases(), NumBases);
360+
return llvm::ArrayRef(getBases(), NumBases);
361361
}
362362

363363
ArrayRef<CXXBaseSpecifier> vbases() const {
364-
return llvm::makeArrayRef(getVBases(), NumVBases);
364+
return llvm::ArrayRef(getVBases(), NumVBases);
365365
}
366366

367367
private:
@@ -3739,7 +3739,7 @@ class UsingPackDecl final
37393739
/// Get the set of using declarations that this pack expanded into. Note that
37403740
/// some of these may still be unresolved.
37413741
ArrayRef<NamedDecl *> expansions() const {
3742-
return llvm::makeArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions);
3742+
return llvm::ArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions);
37433743
}
37443744

37453745
static UsingPackDecl *Create(ASTContext &C, DeclContext *DC,
@@ -4109,7 +4109,7 @@ class DecompositionDecl final
41094109
unsigned NumBindings);
41104110

41114111
ArrayRef<BindingDecl *> bindings() const {
4112-
return llvm::makeArrayRef(getTrailingObjects<BindingDecl *>(), NumBindings);
4112+
return llvm::ArrayRef(getTrailingObjects<BindingDecl *>(), NumBindings);
41134113
}
41144114

41154115
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override;

clang/include/clang/AST/DeclObjC.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
373373
// ArrayRef access to formal parameters. This should eventually
374374
// replace the iterator interface above.
375375
ArrayRef<ParmVarDecl*> parameters() const {
376-
return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
377-
NumParams);
376+
return llvm::ArrayRef(const_cast<ParmVarDecl **>(getParams()), NumParams);
378377
}
379378

380379
ParmVarDecl *getParamDecl(unsigned Idx) {

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
118118

119119
ArrayRef<const Expr *> getVars() const {
120120
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
121-
return llvm::makeArrayRef(Storage, Data->getNumChildren());
121+
return llvm::ArrayRef(Storage, Data->getNumChildren());
122122
}
123123

124124
MutableArrayRef<Expr *> getVars() {
@@ -481,7 +481,7 @@ class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
481481

482482
ArrayRef<const Expr *> getVars() const {
483483
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
484-
return llvm::makeArrayRef(Storage, Data->getNumChildren());
484+
return llvm::ArrayRef(Storage, Data->getNumChildren());
485485
}
486486

487487
MutableArrayRef<Expr *> getVars() {

clang/include/clang/AST/DeclTemplate.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,9 @@ class TemplateParameterList final
129129

130130
unsigned size() const { return NumParams; }
131131

132-
ArrayRef<NamedDecl*> asArray() {
133-
return llvm::makeArrayRef(begin(), end());
134-
}
132+
ArrayRef<NamedDecl *> asArray() { return llvm::ArrayRef(begin(), end()); }
135133
ArrayRef<const NamedDecl*> asArray() const {
136-
return llvm::makeArrayRef(begin(), size());
134+
return llvm::ArrayRef(begin(), size());
137135
}
138136

139137
NamedDecl* getParam(unsigned Idx) {
@@ -289,7 +287,7 @@ class TemplateArgumentList final
289287

290288
/// Produce this as an array ref.
291289
ArrayRef<TemplateArgument> asArray() const {
292-
return llvm::makeArrayRef(data(), size());
290+
return llvm::ArrayRef(data(), size());
293291
}
294292

295293
/// Retrieve the number of template arguments in this
@@ -741,7 +739,7 @@ class DependentFunctionTemplateSpecializationInfo final
741739
unsigned getNumTemplateArgs() const { return NumArgs; }
742740

743741
llvm::ArrayRef<TemplateArgumentLoc> arguments() const {
744-
return llvm::makeArrayRef(getTemplateArgs(), getNumTemplateArgs());
742+
return llvm::ArrayRef(getTemplateArgs(), getNumTemplateArgs());
745743
}
746744

747745
/// Returns the nth template argument.

clang/include/clang/AST/Expr.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,7 +3020,7 @@ class CallExpr : public Expr {
30203020
/// Compute and set dependence bits.
30213021
void computeDependence() {
30223022
setDependence(clang::computeDependence(
3023-
this, llvm::makeArrayRef(
3023+
this, llvm::ArrayRef(
30243024
reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
30253025
getNumPreArgs())));
30263026
}
@@ -3067,8 +3067,8 @@ class CallExpr : public Expr {
30673067
/// interface. This provides efficient reverse iteration of the
30683068
/// subexpressions. This is currently used for CFG construction.
30693069
ArrayRef<Stmt *> getRawSubExprs() {
3070-
return llvm::makeArrayRef(getTrailingStmts(),
3071-
PREARGS_START + getNumPreArgs() + getNumArgs());
3070+
return llvm::ArrayRef(getTrailingStmts(),
3071+
PREARGS_START + getNumPreArgs() + getNumArgs());
30723072
}
30733073

30743074
/// Get FPOptionsOverride from trailing storage.
@@ -4834,12 +4834,10 @@ class InitListExpr : public Expr {
48344834
return reinterpret_cast<Expr * const *>(InitExprs.data());
48354835
}
48364836

4837-
ArrayRef<Expr *> inits() {
4838-
return llvm::makeArrayRef(getInits(), getNumInits());
4839-
}
4837+
ArrayRef<Expr *> inits() { return llvm::ArrayRef(getInits(), getNumInits()); }
48404838

48414839
ArrayRef<Expr *> inits() const {
4842-
return llvm::makeArrayRef(getInits(), getNumInits());
4840+
return llvm::ArrayRef(getInits(), getNumInits());
48434841
}
48444842

48454843
const Expr *getInit(unsigned Init) const {
@@ -5581,9 +5579,7 @@ class ParenListExpr final
55815579
return reinterpret_cast<Expr **>(getTrailingObjects<Stmt *>());
55825580
}
55835581

5584-
ArrayRef<Expr *> exprs() {
5585-
return llvm::makeArrayRef(getExprs(), getNumExprs());
5586-
}
5582+
ArrayRef<Expr *> exprs() { return llvm::ArrayRef(getExprs(), getNumExprs()); }
55875583

55885584
SourceLocation getLParenLoc() const { return LParenLoc; }
55895585
SourceLocation getRParenLoc() const { return RParenLoc; }
@@ -6434,7 +6430,7 @@ class RecoveryExpr final : public Expr,
64346430

64356431
ArrayRef<Expr *> subExpressions() {
64366432
auto *B = getTrailingObjects<Expr *>();
6437-
return llvm::makeArrayRef(B, B + NumExprs);
6433+
return llvm::ArrayRef(B, B + NumExprs);
64386434
}
64396435

64406436
ArrayRef<const Expr *> subExpressions() const {

clang/include/clang/AST/ExprCXX.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,8 +2796,7 @@ class TypeTraitExpr final
27962796

27972797
/// Retrieve the argument types.
27982798
ArrayRef<TypeSourceInfo *> getArgs() const {
2799-
return llvm::makeArrayRef(getTrailingObjects<TypeSourceInfo *>(),
2800-
getNumArgs());
2799+
return llvm::ArrayRef(getTrailingObjects<TypeSourceInfo *>(), getNumArgs());
28012800
}
28022801

28032802
SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
@@ -3443,8 +3442,7 @@ class ExprWithCleanups final
34433442
ArrayRef<CleanupObject> objects);
34443443

34453444
ArrayRef<CleanupObject> getObjects() const {
3446-
return llvm::makeArrayRef(getTrailingObjects<CleanupObject>(),
3447-
getNumObjects());
3445+
return llvm::ArrayRef(getTrailingObjects<CleanupObject>(), getNumObjects());
34483446
}
34493447

34503448
unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; }
@@ -4295,7 +4293,7 @@ class SizeOfPackExpr final
42954293
ArrayRef<TemplateArgument> getPartialArguments() const {
42964294
assert(isPartiallySubstituted());
42974295
const auto *Args = getTrailingObjects<TemplateArgument>();
4298-
return llvm::makeArrayRef(Args, Args + Length);
4296+
return llvm::ArrayRef(Args, Args + Length);
42994297
}
43004298

43014299
SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }

clang/include/clang/AST/ExprObjC.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,11 +1415,10 @@ class ObjCMessageExpr final
14151415
SourceLocation getSelectorLoc(unsigned Index) const {
14161416
assert(Index < getNumSelectorLocs() && "Index out of range!");
14171417
if (hasStandardSelLocs())
1418-
return getStandardSelectorLoc(Index, getSelector(),
1419-
getSelLocsKind() == SelLoc_StandardWithSpace,
1420-
llvm::makeArrayRef(const_cast<Expr**>(getArgs()),
1421-
getNumArgs()),
1422-
RBracLoc);
1418+
return getStandardSelectorLoc(
1419+
Index, getSelector(), getSelLocsKind() == SelLoc_StandardWithSpace,
1420+
llvm::ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()),
1421+
RBracLoc);
14231422
return getStoredSelLocs()[Index];
14241423
}
14251424

clang/include/clang/AST/ExprOpenMP.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ class OMPArrayShapingExpr final
202202

203203
/// Fetches the dimensions for array shaping expression.
204204
ArrayRef<Expr *> getDimensions() const {
205-
return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumDims);
205+
return llvm::ArrayRef(getTrailingObjects<Expr *>(), NumDims);
206206
}
207207

208208
/// Fetches source ranges for the brackets os the array shaping expression.
209209
ArrayRef<SourceRange> getBracketsRanges() const {
210-
return llvm::makeArrayRef(getTrailingObjects<SourceRange>(), NumDims);
210+
return llvm::ArrayRef(getTrailingObjects<SourceRange>(), NumDims);
211211
}
212212

213213
/// Fetches base expression of array shaping expression.

0 commit comments

Comments
 (0)