Skip to content

[NFC][Clang][AST] Drop llvm:: in front of ArrayRef/MutableArrayRef #145207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang/include/clang/AST/AbstractBasicReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ class DataStreamBasicReader : public BasicReaderBase<Impl> {
// structure into a single data stream.
Impl &readObject() { return asImpl(); }

template <class T>
llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
template <class T> ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
assert(buffer.empty());

uint32_t size = asImpl().readUInt32();
Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/AST/AbstractBasicWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ class DataStreamBasicWriter : public BasicWriterBase<Impl> {
asImpl().writeUInt32(uint32_t(value));
}

template <class T>
void writeArray(llvm::ArrayRef<T> array) {
template <class T> void writeArray(ArrayRef<T> array) {
asImpl().writeUInt32(array.size());
for (const T &elt : array) {
WriteDispatcher<T>::write(asImpl(), elt);
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/AST/ComputeDependence.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "clang/AST/DependenceFlags.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "llvm/ADT/ArrayRef.h"
#include "clang/Basic/LLVM.h"

namespace clang {

Expand Down Expand Up @@ -180,7 +180,7 @@ ExprDependence computeDependence(ConceptSpecializationExpr *E,

ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
ExprDependence computeDependence(PredefinedExpr *E);
ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
ExprDependence computeDependence(CallExpr *E, ArrayRef<Expr *> PreArgs);
ExprDependence computeDependence(OffsetOfExpr *E);
ExprDependence computeDependence(MemberExpr *E);
ExprDependence computeDependence(ShuffleVectorExpr *E);
Expand Down
7 changes: 2 additions & 5 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3417,16 +3417,13 @@ class IndirectFieldDecl : public ValueDecl,

static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, const IdentifierInfo *Id,
QualType T,
llvm::MutableArrayRef<NamedDecl *> CH);
QualType T, MutableArrayRef<NamedDecl *> CH);

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

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

ArrayRef<NamedDecl *> chain() const {
return llvm::ArrayRef(Chaining, ChainingSize);
}
ArrayRef<NamedDecl *> chain() const { return {Chaining, ChainingSize}; }
chain_iterator chain_begin() const { return chain().begin(); }
chain_iterator chain_end() const { return chain().end(); }

Expand Down
14 changes: 6 additions & 8 deletions clang/include/clang/AST/DeclCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,10 @@ class CXXRecordDecl : public RecordDecl {
return getVBasesSlowCase();
}

ArrayRef<CXXBaseSpecifier> bases() const {
return llvm::ArrayRef(getBases(), NumBases);
}
ArrayRef<CXXBaseSpecifier> bases() const { return {getBases(), NumBases}; }

ArrayRef<CXXBaseSpecifier> vbases() const {
return llvm::ArrayRef(getVBases(), NumVBases);
return {getVBases(), NumVBases};
}

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

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

/// Get the decomposition declaration that this binding represents a
/// decomposition of.
Expand Down Expand Up @@ -4269,11 +4267,11 @@ class DecompositionDecl final

// Provide a flattened range to visit each binding.
auto flat_bindings() const {
llvm::ArrayRef<BindingDecl *> Bindings = bindings();
llvm::ArrayRef<BindingDecl *> PackBindings;
ArrayRef<BindingDecl *> Bindings = bindings();
ArrayRef<BindingDecl *> PackBindings;

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

Bindings = Bindings.drop_front(BeforePackBindings.size());
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/DeclObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext {
// ArrayRef access to formal parameters. This should eventually
// replace the iterator interface above.
ArrayRef<ParmVarDecl*> parameters() const {
return llvm::ArrayRef(const_cast<ParmVarDecl **>(getParams()), NumParams);
return {const_cast<ParmVarDecl **>(getParams()), NumParams};
}

ParmVarDecl *getParamDecl(unsigned Idx) {
Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/AST/DeclOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {

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

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

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

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

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

void setVars(ArrayRef<Expr *> VL);
Expand Down
8 changes: 3 additions & 5 deletions clang/include/clang/AST/DeclTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ class TemplateParameterList final
unsigned size() const { return NumParams; }
bool empty() const { return NumParams == 0; }

ArrayRef<NamedDecl *> asArray() { return llvm::ArrayRef(begin(), end()); }
ArrayRef<const NamedDecl*> asArray() const {
return llvm::ArrayRef(begin(), size());
}
ArrayRef<NamedDecl *> asArray() { return {begin(), end()}; }
ArrayRef<const NamedDecl *> asArray() const { return {begin(), size()}; }

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

void loadLazySpecializationsImpl(bool OnlyPartial = false) const;

bool loadLazySpecializationsImpl(llvm::ArrayRef<TemplateArgument> Args,
bool loadLazySpecializationsImpl(ArrayRef<TemplateArgument> Args,
TemplateParameterList *TPL = nullptr) const;

template <class EntryType, typename... ProfileArguments>
Expand Down
27 changes: 12 additions & 15 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3106,9 +3106,9 @@ class CallExpr : public Expr {
/// Compute and set dependence bits.
void computeDependence() {
setDependence(clang::computeDependence(
this, llvm::ArrayRef(
reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
getNumPreArgs())));
this,
ArrayRef(reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
getNumPreArgs())));
}

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

/// Get FPOptionsOverride from trailing storage.
Expand Down Expand Up @@ -5276,11 +5275,9 @@ class InitListExpr : public Expr {
return reinterpret_cast<Expr * const *>(InitExprs.data());
}

ArrayRef<Expr *> inits() { return llvm::ArrayRef(getInits(), getNumInits()); }
ArrayRef<Expr *> inits() { return {getInits(), getNumInits()}; }

ArrayRef<Expr *> inits() const {
return llvm::ArrayRef(getInits(), getNumInits());
}
ArrayRef<Expr *> inits() const { return {getInits(), getNumInits()}; }

const Expr *getInit(unsigned Init) const {
assert(Init < getNumInits() && "Initializer access out of range!");
Expand Down Expand Up @@ -5508,7 +5505,7 @@ class DesignatedInitExpr final
Designator *Designators;

DesignatedInitExpr(const ASTContext &C, QualType Ty,
llvm::ArrayRef<Designator> Designators,
ArrayRef<Designator> Designators,
SourceLocation EqualOrColonLoc, bool GNUSyntax,
ArrayRef<Expr *> IndexExprs, Expr *Init);

Expand Down Expand Up @@ -5701,8 +5698,8 @@ class DesignatedInitExpr final
};

static DesignatedInitExpr *Create(const ASTContext &C,
llvm::ArrayRef<Designator> Designators,
ArrayRef<Expr*> IndexExprs,
ArrayRef<Designator> Designators,
ArrayRef<Expr *> IndexExprs,
SourceLocation EqualOrColonLoc,
bool GNUSyntax, Expr *Init);

Expand All @@ -5713,11 +5710,11 @@ class DesignatedInitExpr final
unsigned size() const { return NumDesignators; }

// Iterator access to the designators.
llvm::MutableArrayRef<Designator> designators() {
MutableArrayRef<Designator> designators() {
return {Designators, NumDesignators};
}

llvm::ArrayRef<Designator> designators() const {
ArrayRef<Designator> designators() const {
return {Designators, NumDesignators};
}

Expand Down Expand Up @@ -6052,7 +6049,7 @@ class ParenListExpr final

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

ArrayRef<Expr *> exprs() { return llvm::ArrayRef(getExprs(), getNumExprs()); }
ArrayRef<Expr *> exprs() { return {getExprs(), getNumExprs()}; }

SourceLocation getLParenLoc() const { return LParenLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/AST/ExprObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -1421,8 +1421,7 @@ class ObjCMessageExpr final
if (hasStandardSelLocs())
return getStandardSelectorLoc(
Index, getSelector(), getSelLocsKind() == SelLoc_StandardWithSpace,
llvm::ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()),
RBracLoc);
ArrayRef(const_cast<Expr **>(getArgs()), getNumArgs()), RBracLoc);
return getStoredSelLocs()[Index];
}

Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/AST/ExternalASTMerger.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ExternalASTMerger : public ExternalASTSource {

public:
ExternalASTMerger(const ImporterTarget &Target,
llvm::ArrayRef<ImporterSource> Sources);
ArrayRef<ImporterSource> Sources);

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

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

/// Implementation of the ExternalASTSource API.
bool FindExternalVisibleDeclsByName(const DeclContext *DC,
Expand Down
18 changes: 7 additions & 11 deletions clang/include/clang/AST/OpenACCClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {

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

public:
static bool classof(const OpenACCClause *C);
Expand Down Expand Up @@ -563,10 +563,10 @@ class OpenACCWaitClause final
SourceLocation getQueuesLoc() const { return QueuesLoc; }
bool hasDevNumExpr() const { return getExprs()[0]; }
Expr *getDevNumExpr() const { return getExprs()[0]; }
llvm::ArrayRef<Expr *> getQueueIdExprs() {
ArrayRef<Expr *> getQueueIdExprs() {
return OpenACCClauseWithExprs::getExprs().drop_front();
}
llvm::ArrayRef<Expr *> getQueueIdExprs() const {
ArrayRef<Expr *> getQueueIdExprs() const {
return OpenACCClauseWithExprs::getExprs().drop_front();
}
// If this is a plain `wait` (no parens) this returns 'false'. Else Sema/Parse
Expand Down Expand Up @@ -594,11 +594,9 @@ class OpenACCNumGangsClause final
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);

llvm::ArrayRef<Expr *> getIntExprs() {
return OpenACCClauseWithExprs::getExprs();
}
ArrayRef<Expr *> getIntExprs() { return OpenACCClauseWithExprs::getExprs(); }

llvm::ArrayRef<Expr *> getIntExprs() const {
ArrayRef<Expr *> getIntExprs() const {
return OpenACCClauseWithExprs::getExprs();
}
};
Expand All @@ -622,11 +620,9 @@ class OpenACCTileClause final
SourceLocation LParenLoc,
ArrayRef<Expr *> SizeExprs,
SourceLocation EndLoc);
llvm::ArrayRef<Expr *> getSizeExprs() {
return OpenACCClauseWithExprs::getExprs();
}
ArrayRef<Expr *> getSizeExprs() { return OpenACCClauseWithExprs::getExprs(); }

llvm::ArrayRef<Expr *> getSizeExprs() const {
ArrayRef<Expr *> getSizeExprs() const {
return OpenACCClauseWithExprs::getExprs();
}
};
Expand Down
Loading
Loading