Skip to content

Commit 6cf656e

Browse files
authored
[NFC][Clang][AST] Drop llvm:: in front of ArrayRef/MutableArrayRef (#145207)
1 parent 6621441 commit 6cf656e

Some content is hidden

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

46 files changed

+238
-265
lines changed

clang/include/clang/AST/AbstractBasicReader.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ class DataStreamBasicReader : public BasicReaderBase<Impl> {
143143
// structure into a single data stream.
144144
Impl &readObject() { return asImpl(); }
145145

146-
template <class T>
147-
llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
146+
template <class T> ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148147
assert(buffer.empty());
149148

150149
uint32_t size = asImpl().readUInt32();

clang/include/clang/AST/AbstractBasicWriter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ class DataStreamBasicWriter : public BasicWriterBase<Impl> {
138138
asImpl().writeUInt32(uint32_t(value));
139139
}
140140

141-
template <class T>
142-
void writeArray(llvm::ArrayRef<T> array) {
141+
template <class T> void writeArray(ArrayRef<T> array) {
143142
asImpl().writeUInt32(array.size());
144143
for (const T &elt : array) {
145144
WriteDispatcher<T>::write(asImpl(), elt);

clang/include/clang/AST/ComputeDependence.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "clang/AST/DependenceFlags.h"
1717
#include "clang/Basic/ExceptionSpecificationType.h"
18-
#include "llvm/ADT/ArrayRef.h"
18+
#include "clang/Basic/LLVM.h"
1919

2020
namespace clang {
2121

@@ -180,7 +180,7 @@ ExprDependence computeDependence(ConceptSpecializationExpr *E,
180180

181181
ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
182182
ExprDependence computeDependence(PredefinedExpr *E);
183-
ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
183+
ExprDependence computeDependence(CallExpr *E, ArrayRef<Expr *> PreArgs);
184184
ExprDependence computeDependence(OffsetOfExpr *E);
185185
ExprDependence computeDependence(MemberExpr *E);
186186
ExprDependence computeDependence(ShuffleVectorExpr *E);

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,16 +3422,13 @@ class IndirectFieldDecl : public ValueDecl,
34223422

34233423
static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC,
34243424
SourceLocation L, const IdentifierInfo *Id,
3425-
QualType T,
3426-
llvm::MutableArrayRef<NamedDecl *> CH);
3425+
QualType T, MutableArrayRef<NamedDecl *> CH);
34273426

34283427
static IndirectFieldDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
34293428

34303429
using chain_iterator = ArrayRef<NamedDecl *>::const_iterator;
34313430

3432-
ArrayRef<NamedDecl *> chain() const {
3433-
return llvm::ArrayRef(Chaining, ChainingSize);
3434-
}
3431+
ArrayRef<NamedDecl *> chain() const { return {Chaining, ChainingSize}; }
34353432
chain_iterator chain_begin() const { return chain().begin(); }
34363433
chain_iterator chain_end() const { return chain().end(); }
34373434

clang/include/clang/AST/DeclCXX.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,10 @@ class CXXRecordDecl : public RecordDecl {
365365
return getVBasesSlowCase();
366366
}
367367

368-
ArrayRef<CXXBaseSpecifier> bases() const {
369-
return llvm::ArrayRef(getBases(), NumBases);
370-
}
368+
ArrayRef<CXXBaseSpecifier> bases() const { return {getBases(), NumBases}; }
371369

372370
ArrayRef<CXXBaseSpecifier> vbases() const {
373-
return llvm::ArrayRef(getVBases(), NumVBases);
371+
return {getVBases(), NumVBases};
374372
}
375373

376374
private:
@@ -4190,7 +4188,7 @@ class BindingDecl : public ValueDecl {
41904188
Expr *getBinding() const { return Binding; }
41914189

41924190
// Get the array of nested BindingDecls when the binding represents a pack.
4193-
llvm::ArrayRef<BindingDecl *> getBindingPackDecls() const;
4191+
ArrayRef<BindingDecl *> getBindingPackDecls() const;
41944192

41954193
/// Get the decomposition declaration that this binding represents a
41964194
/// decomposition of.
@@ -4269,11 +4267,11 @@ class DecompositionDecl final
42694267

42704268
// Provide a flattened range to visit each binding.
42714269
auto flat_bindings() const {
4272-
llvm::ArrayRef<BindingDecl *> Bindings = bindings();
4273-
llvm::ArrayRef<BindingDecl *> PackBindings;
4270+
ArrayRef<BindingDecl *> Bindings = bindings();
4271+
ArrayRef<BindingDecl *> PackBindings;
42744272

42754273
// Split the bindings into subranges split by the pack.
4276-
llvm::ArrayRef<BindingDecl *> BeforePackBindings = Bindings.take_until(
4274+
ArrayRef<BindingDecl *> BeforePackBindings = Bindings.take_until(
42774275
[](BindingDecl *BD) { return BD->isParameterPack(); });
42784276

42794277
Bindings = Bindings.drop_front(BeforePackBindings.size());

clang/include/clang/AST/DeclObjC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
371371
// ArrayRef access to formal parameters. This should eventually
372372
// replace the iterator interface above.
373373
ArrayRef<ParmVarDecl*> parameters() const {
374-
return llvm::ArrayRef(const_cast<ParmVarDecl **>(getParams()), NumParams);
374+
return {const_cast<ParmVarDecl **>(getParams()), NumParams};
375375
}
376376

377377
ParmVarDecl *getParamDecl(unsigned Idx) {

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ 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::ArrayRef(Storage, Data->getNumChildren());
121+
return {Storage, Data->getNumChildren()};
122122
}
123123

124124
MutableArrayRef<Expr *> getVars() {
125125
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
126-
return llvm::MutableArrayRef(Storage, Data->getNumChildren());
126+
return {Storage, Data->getNumChildren()};
127127
}
128128

129129
void setVars(ArrayRef<Expr *> VL);
@@ -482,12 +482,12 @@ class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
482482

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

488488
MutableArrayRef<Expr *> getVars() {
489489
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
490-
return llvm::MutableArrayRef(Storage, Data->getNumChildren());
490+
return {Storage, Data->getNumChildren()};
491491
}
492492

493493
void setVars(ArrayRef<Expr *> VL);

clang/include/clang/AST/DeclTemplate.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,8 @@ class TemplateParameterList final
139139
unsigned size() const { return NumParams; }
140140
bool empty() const { return NumParams == 0; }
141141

142-
ArrayRef<NamedDecl *> asArray() { return llvm::ArrayRef(begin(), end()); }
143-
ArrayRef<const NamedDecl*> asArray() const {
144-
return llvm::ArrayRef(begin(), size());
145-
}
142+
ArrayRef<NamedDecl *> asArray() { return {begin(), end()}; }
143+
ArrayRef<const NamedDecl *> asArray() const { return {begin(), size()}; }
146144

147145
NamedDecl* getParam(unsigned Idx) {
148146
assert(Idx < size() && "Template parameter index out-of-range");
@@ -772,7 +770,7 @@ class RedeclarableTemplateDecl : public TemplateDecl,
772770

773771
void loadLazySpecializationsImpl(bool OnlyPartial = false) const;
774772

775-
bool loadLazySpecializationsImpl(llvm::ArrayRef<TemplateArgument> Args,
773+
bool loadLazySpecializationsImpl(ArrayRef<TemplateArgument> Args,
776774
TemplateParameterList *TPL = nullptr) const;
777775

778776
template <class EntryType, typename... ProfileArguments>

clang/include/clang/AST/Expr.h

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3097,9 +3097,9 @@ class CallExpr : public Expr {
30973097
/// Compute and set dependence bits.
30983098
void computeDependence() {
30993099
setDependence(clang::computeDependence(
3100-
this, llvm::ArrayRef(
3101-
reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
3102-
getNumPreArgs())));
3100+
this,
3101+
ArrayRef(reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
3102+
getNumPreArgs())));
31033103
}
31043104

31053105
/// Reduce the number of arguments in this call expression. This is used for
@@ -3144,8 +3144,7 @@ class CallExpr : public Expr {
31443144
/// interface. This provides efficient reverse iteration of the
31453145
/// subexpressions. This is currently used for CFG construction.
31463146
ArrayRef<Stmt *> getRawSubExprs() {
3147-
return llvm::ArrayRef(getTrailingStmts(),
3148-
PREARGS_START + getNumPreArgs() + getNumArgs());
3147+
return {getTrailingStmts(), PREARGS_START + getNumPreArgs() + getNumArgs()};
31493148
}
31503149

31513150
/// Get FPOptionsOverride from trailing storage.
@@ -5267,11 +5266,9 @@ class InitListExpr : public Expr {
52675266
return reinterpret_cast<Expr * const *>(InitExprs.data());
52685267
}
52695268

5270-
ArrayRef<Expr *> inits() { return llvm::ArrayRef(getInits(), getNumInits()); }
5269+
ArrayRef<Expr *> inits() { return {getInits(), getNumInits()}; }
52715270

5272-
ArrayRef<Expr *> inits() const {
5273-
return llvm::ArrayRef(getInits(), getNumInits());
5274-
}
5271+
ArrayRef<Expr *> inits() const { return {getInits(), getNumInits()}; }
52755272

52765273
const Expr *getInit(unsigned Init) const {
52775274
assert(Init < getNumInits() && "Initializer access out of range!");
@@ -5499,7 +5496,7 @@ class DesignatedInitExpr final
54995496
Designator *Designators;
55005497

55015498
DesignatedInitExpr(const ASTContext &C, QualType Ty,
5502-
llvm::ArrayRef<Designator> Designators,
5499+
ArrayRef<Designator> Designators,
55035500
SourceLocation EqualOrColonLoc, bool GNUSyntax,
55045501
ArrayRef<Expr *> IndexExprs, Expr *Init);
55055502

@@ -5692,8 +5689,8 @@ class DesignatedInitExpr final
56925689
};
56935690

56945691
static DesignatedInitExpr *Create(const ASTContext &C,
5695-
llvm::ArrayRef<Designator> Designators,
5696-
ArrayRef<Expr*> IndexExprs,
5692+
ArrayRef<Designator> Designators,
5693+
ArrayRef<Expr *> IndexExprs,
56975694
SourceLocation EqualOrColonLoc,
56985695
bool GNUSyntax, Expr *Init);
56995696

@@ -5704,11 +5701,11 @@ class DesignatedInitExpr final
57045701
unsigned size() const { return NumDesignators; }
57055702

57065703
// Iterator access to the designators.
5707-
llvm::MutableArrayRef<Designator> designators() {
5704+
MutableArrayRef<Designator> designators() {
57085705
return {Designators, NumDesignators};
57095706
}
57105707

5711-
llvm::ArrayRef<Designator> designators() const {
5708+
ArrayRef<Designator> designators() const {
57125709
return {Designators, NumDesignators};
57135710
}
57145711

@@ -6043,7 +6040,7 @@ class ParenListExpr final
60436040

60446041
Expr **getExprs() { return reinterpret_cast<Expr **>(getTrailingObjects()); }
60456042

6046-
ArrayRef<Expr *> exprs() { return llvm::ArrayRef(getExprs(), getNumExprs()); }
6043+
ArrayRef<Expr *> exprs() { return {getExprs(), getNumExprs()}; }
60476044

60486045
SourceLocation getLParenLoc() const { return LParenLoc; }
60496046
SourceLocation getRParenLoc() const { return RParenLoc; }

clang/include/clang/AST/ExprObjC.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,7 @@ class ObjCMessageExpr final
14211421
if (hasStandardSelLocs())
14221422
return getStandardSelectorLoc(
14231423
Index, getSelector(), getSelLocsKind() == SelLoc_StandardWithSpace,
1424-
llvm::ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()),
1425-
RBracLoc);
1424+
ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()), RBracLoc);
14261425
return getStoredSelLocs()[Index];
14271426
}
14281427

clang/include/clang/AST/ExternalASTMerger.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ExternalASTMerger : public ExternalASTSource {
113113

114114
public:
115115
ExternalASTMerger(const ImporterTarget &Target,
116-
llvm::ArrayRef<ImporterSource> Sources);
116+
ArrayRef<ImporterSource> Sources);
117117

118118
/// Asks all connected ASTImporters if any of them imported the given
119119
/// declaration. If any ASTImporter did import the given declaration,
@@ -128,7 +128,7 @@ class ExternalASTMerger : public ExternalASTSource {
128128
/// newly-parsed source files).
129129
///
130130
/// Ensures that Importers does not gain duplicate entries as a result.
131-
void AddSources(llvm::ArrayRef<ImporterSource> Sources);
131+
void AddSources(ArrayRef<ImporterSource> Sources);
132132

133133
/// Remove a set of ASTContexts as possible origins.
134134
///
@@ -137,7 +137,7 @@ class ExternalASTMerger : public ExternalASTSource {
137137
///
138138
/// The caller is responsible for ensuring that this doesn't leave
139139
/// DeclContexts that can't be completed.
140-
void RemoveSources(llvm::ArrayRef<ImporterSource> Sources);
140+
void RemoveSources(ArrayRef<ImporterSource> Sources);
141141

142142
/// Implementation of the ExternalASTSource API.
143143
bool FindExternalVisibleDeclsByName(const DeclContext *DC,

clang/include/clang/AST/OpenACCClause.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
513513

514514
/// Gets the entire list of expressions, but leave it to the
515515
/// individual clauses to expose this how they'd like.
516-
llvm::ArrayRef<Expr *> getExprs() const { return Exprs; }
516+
ArrayRef<Expr *> getExprs() const { return Exprs; }
517517

518518
public:
519519
static bool classof(const OpenACCClause *C);
@@ -563,10 +563,10 @@ class OpenACCWaitClause final
563563
SourceLocation getQueuesLoc() const { return QueuesLoc; }
564564
bool hasDevNumExpr() const { return getExprs()[0]; }
565565
Expr *getDevNumExpr() const { return getExprs()[0]; }
566-
llvm::ArrayRef<Expr *> getQueueIdExprs() {
566+
ArrayRef<Expr *> getQueueIdExprs() {
567567
return OpenACCClauseWithExprs::getExprs().drop_front();
568568
}
569-
llvm::ArrayRef<Expr *> getQueueIdExprs() const {
569+
ArrayRef<Expr *> getQueueIdExprs() const {
570570
return OpenACCClauseWithExprs::getExprs().drop_front();
571571
}
572572
// If this is a plain `wait` (no parens) this returns 'false'. Else Sema/Parse
@@ -594,11 +594,9 @@ class OpenACCNumGangsClause final
594594
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
595595
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);
596596

597-
llvm::ArrayRef<Expr *> getIntExprs() {
598-
return OpenACCClauseWithExprs::getExprs();
599-
}
597+
ArrayRef<Expr *> getIntExprs() { return OpenACCClauseWithExprs::getExprs(); }
600598

601-
llvm::ArrayRef<Expr *> getIntExprs() const {
599+
ArrayRef<Expr *> getIntExprs() const {
602600
return OpenACCClauseWithExprs::getExprs();
603601
}
604602
};
@@ -622,11 +620,9 @@ class OpenACCTileClause final
622620
SourceLocation LParenLoc,
623621
ArrayRef<Expr *> SizeExprs,
624622
SourceLocation EndLoc);
625-
llvm::ArrayRef<Expr *> getSizeExprs() {
626-
return OpenACCClauseWithExprs::getExprs();
627-
}
623+
ArrayRef<Expr *> getSizeExprs() { return OpenACCClauseWithExprs::getExprs(); }
628624

629-
llvm::ArrayRef<Expr *> getSizeExprs() const {
625+
ArrayRef<Expr *> getSizeExprs() const {
630626
return OpenACCClauseWithExprs::getExprs();
631627
}
632628
};

0 commit comments

Comments
 (0)