[clang] 39ca925 - [AST] Use llvm::iterator_range::empty (NFC) (#151904)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 4 07:40:42 PDT 2025
Author: Kazu Hirata
Date: 2025-08-04T07:40:38-07:00
New Revision: 39ca925ffefe2f8307e6ead1f7ffd99c58528d0f
URL: https://github.com/llvm/llvm-project/commit/39ca925ffefe2f8307e6ead1f7ffd99c58528d0f
DIFF: https://github.com/llvm/llvm-project/commit/39ca925ffefe2f8307e6ead1f7ffd99c58528d0f.diff
LOG: [AST] Use llvm::iterator_range::empty (NFC) (#151904)
Added:
Modified:
clang/lib/AST/ByteCode/Compiler.cpp
clang/lib/AST/ByteCode/Context.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/DeclPrinter.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/QualTypeNames.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 7a5bd4dfc0bed..5bcac390feeae 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5914,7 +5914,7 @@ bool Compiler<Emitter>::emitLambdaStaticInvokerBody(const CXXMethodDecl *MD) {
const CXXRecordDecl *ClosureClass = MD->getParent();
const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator();
- assert(ClosureClass->captures_begin() == ClosureClass->captures_end());
+ assert(ClosureClass->captures().empty());
const Function *Func = this->getFunction(LambdaCallOp);
if (!Func)
return false;
diff --git a/clang/lib/AST/ByteCode/Context.cpp b/clang/lib/AST/ByteCode/Context.cpp
index 7215e1dd03ae1..037e17abc6bc3 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -474,7 +474,7 @@ const Function *Context::getOrCreateFunction(const FunctionDecl *FuncDecl) {
IsLambdaStaticInvoker = true;
const CXXRecordDecl *ClosureClass = MD->getParent();
- assert(ClosureClass->captures_begin() == ClosureClass->captures_end());
+ assert(ClosureClass->captures().empty());
if (ClosureClass->isGenericLambda()) {
const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator();
assert(MD->isFunctionTemplateSpecialization() &&
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 673e3f73858c7..037a28c4255f4 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1983,7 +1983,7 @@ CXXRecordDecl::getVisibleConversionFunctions() const {
ASTContext &Ctx = getASTContext();
ASTUnresolvedSet *Set;
- if (bases_begin() == bases_end()) {
+ if (bases().empty()) {
// If root class, all conversions are visible.
Set = &data().Conversions.get(Ctx);
} else {
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 9273f5816d5ac..f4265dd07bd46 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -1443,7 +1443,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
lastPos = pos + 1;
}
- if (OMD->param_begin() == OMD->param_end())
+ if (OMD->parameters().empty())
Out << name;
if (OMD->isVariadic())
@@ -1480,8 +1480,7 @@ void DeclPrinter::VisitObjCImplementationDecl(ObjCImplementationDecl *OID) {
}
Indentation -= Policy.Indentation;
Out << "}\n";
- }
- else if (SID || (OID->decls_begin() != OID->decls_end())) {
+ } else if (SID || !OID->decls().empty()) {
Out << "\n";
eolnOut = true;
}
@@ -1540,8 +1539,7 @@ void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
}
Indentation -= Policy.Indentation;
Out << "}\n";
- }
- else if (SID || (OID->decls_begin() != OID->decls_end())) {
+ } else if (SID || !OID->decls().empty()) {
Out << "\n";
eolnOut = true;
}
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 20b7c447956b4..3a47fa87b5f77 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8436,7 +8436,7 @@ class ExprEvaluatorBase
// doesn't have an implicit argument passed in.
const CXXRecordDecl *ClosureClass = MD->getParent();
assert(
- ClosureClass->captures_begin() == ClosureClass->captures_end() &&
+ ClosureClass->captures().empty() &&
"Number of captures must be zero for conversion to function-ptr");
const CXXMethodDecl *LambdaCallOp =
diff --git a/clang/lib/AST/QualTypeNames.cpp b/clang/lib/AST/QualTypeNames.cpp
index b43bcd8d1f1c1..9731b3a1a3e3b 100644
--- a/clang/lib/AST/QualTypeNames.cpp
+++ b/clang/lib/AST/QualTypeNames.cpp
@@ -273,7 +273,7 @@ static NestedNameSpecifier *createNestedNameSpecifierForScopeOf(
//
// Make the situation is 'useable' but looking a bit odd by
// picking a random instance as the declaring context.
- if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
+ if (!ClassTempl->specializations().empty()) {
Decl = *(ClassTempl->spec_begin());
Outer = dyn_cast<NamedDecl>(Decl);
OuterNS = dyn_cast<NamespaceDecl>(Decl);
More information about the cfe-commits
mailing list