Skip to content

[llvm] Use llvm::iterator_range::empty (NFC) #151905

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
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
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,7 @@ class DWARFObjInMemory final : public DWARFObject {
continue;
}

if (Section.relocation_begin() == Section.relocation_end())
if (Section.relocations().empty())
continue;

// Symbol to [address, section index] cache mapping.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class MachOLinkGraphBuilder_arm64 : public MachOLinkGraphBuilder {

// Skip relocations virtual sections.
if (S.isVirtual()) {
if (S.relocation_begin() != S.relocation_end())
if (!S.relocations().empty())
return make_error<JITLinkError>("Virtual section contains "
"relocations");
continue;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class MachOLinkGraphBuilder_x86_64 : public MachOLinkGraphBuilder {

// Skip relocations virtual sections.
if (S.isVirtual()) {
if (S.relocation_begin() != S.relocation_end())
if (!S.relocations().empty())
return make_error<JITLinkError>("Virtual section contains "
"relocations");
continue;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,7 @@ Error RuntimeDyldELF::finalizeLoad(const ObjectFile &Obj,
// object's sections to GOTs.
for (section_iterator SI = Obj.section_begin(), SE = Obj.section_end();
SI != SE; ++SI) {
if (SI->relocation_begin() != SI->relocation_end()) {
if (!SI->relocations().empty()) {
Expected<section_iterator> RelSecOrErr = SI->getRelocatedSection();
if (!RelSecOrErr)
return make_error<RuntimeDyldError>(
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SandboxIR/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Value::Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)

Value::use_iterator Value::use_begin() {
llvm::Use *LLVMUse = nullptr;
if (Val->use_begin() != Val->use_end())
if (!Val->uses().empty())
LLVMUse = &*Val->use_begin();
User *User = LLVMUse != nullptr ? cast_or_null<sandboxir::User>(Ctx.getValue(
Val->use_begin()->getUser()))
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/DirectX/DXContainerGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ GlobalVariable *DXContainerGlobals::computeShaderHash(Module &M) {
dxbc::ShaderHash HashData = {0, {0}};
// The Hash's IncludesSource flag gets set whenever the hashed shader includes
// debug information.
if (M.debug_compile_units_begin() != M.debug_compile_units_end())
if (!M.debug_compile_units().empty())
HashData.Flags = static_cast<uint32_t>(dxbc::HashFlags::IncludesSource);

memcpy(reinterpret_cast<void *>(&HashData.Digest), Result.data(), 16);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ bool HexagonCommonGEP::isHandledGepForm(GetElementPtrInst *GepI) {
if (!GepI->getType()->isPointerTy())
return false;
// No GEPs without any indices. (Is this possible?)
if (GepI->idx_begin() == GepI->idx_end())
if (GepI->indices().empty())
return false;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/PredicateInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ PredicateInfo::~PredicateInfo() {
CreatedDeclarations.clear();

for (Function *F : FunctionPtrs) {
assert(F->user_begin() == F->user_end() &&
assert(F->users().empty() &&
"PredicateInfo consumer did not remove all SSA copies.");
F->eraseFromParent();
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-objdump/llvm-objdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,7 @@ void Dumper::printRelocations() {
for (const SectionRef &Section : ToolSectionFilter(O, &Ndx)) {
if (O.isELF() && (ELFSectionRef(Section).getFlags() & ELF::SHF_ALLOC))
continue;
if (Section.relocation_begin() == Section.relocation_end())
if (Section.relocations().empty())
continue;
Expected<section_iterator> SecOrErr = Section.getRelocatedSection();
if (!SecOrErr)
Expand Down