I'm planning to deprecate and eventually remove llvm::empty.
I thought about replacing llvm::empty(x) with std::empty(x), but it
turns out that all uses can be converted to x.empty(). That is, no
use requires the ability of std::empty to accept C arrays and
std::initializer_list.
Differential Revision: https://reviews.llvm.org/D133677
public:
SectionRange() = default;
SectionRange(const Section &Sec) {
- if (llvm::empty(Sec.blocks()))
+ if (Sec.blocks().empty())
return;
First = Last = *Sec.blocks().begin();
for (auto *B : Sec.blocks()) {
// Skip CUs that ended up not being needed (split CUs that were abandoned
// because they added no information beyond the non-split CU)
- if (llvm::empty(TheU->getUnitDie().values()))
+ if (TheU->getUnitDie().values().empty())
return;
Asm->OutStreamer->switchSection(S);
// Skip CUs that ended up not being needed (split CUs that were abandoned
// because they added no information beyond the non-split CU)
- if (llvm::empty(TheU->getUnitDie().values()))
+ if (TheU->getUnitDie().values().empty())
return;
TheU->setDebugSectionOffset(SecOffset);
}
OS << "Absolute symbols:\n";
- if (!llvm::empty(absolute_symbols())) {
+ if (!absolute_symbols().empty()) {
for (auto *Sym : absolute_symbols())
OS << " " << Sym->getAddress() << ": " << *Sym << "\n";
} else
OS << " none\n";
OS << "\nExternal symbols:\n";
- if (!llvm::empty(external_symbols())) {
+ if (!external_symbols().empty()) {
for (auto *Sym : external_symbols())
OS << " " << Sym->getAddress() << ": " << *Sym << "\n";
} else
for (auto &Sec : G.sections()) {
// Skip empty sections.
- if (empty(Sec.blocks()))
+ if (Sec.blocks().empty())
continue;
auto &Seg = Segments[{Sec.getMemProt(), Sec.getMemDeallocPolicy()}];
SmallVector<DebugSectionInfo, 12> DebugSecInfos;
size_t NumSections = 0;
for (auto &Sec : G.sections()) {
- if (llvm::empty(Sec.blocks()))
+ if (Sec.blocks().empty())
continue;
++NumSections;
// Copy debug section blocks and symbols.
orc::ExecutorAddr NextBlockAddr(MachOContainerBlock->getSize());
for (auto &SI : DebugSecInfos) {
- assert(!llvm::empty(SI.Sec->blocks()) && "Empty debug info section?");
+ assert(!SI.Sec->blocks().empty() && "Empty debug info section?");
// Update addresses in debug section.
LLVM_DEBUG({
}
// If we need an init symbol for this module then create one.
- if (!llvm::empty(getStaticInitGVs(M))) {
+ if (!getStaticInitGVs(M).empty()) {
size_t Counter = 0;
do {
auto ObjCImageInfoBlocks = ObjCImageInfo->blocks();
// Check that the section is not empty if present.
- if (llvm::empty(ObjCImageInfoBlocks))
+ if (ObjCImageInfoBlocks.empty())
return make_error<StringError>("Empty " + ObjCImageInfoSectionName +
" section in " + G.getName(),
inconvertibleErrorCode());
LLT SrcTy = MRI.getType(SrcReg);
const bool Signed = Opc == AMDGPU::G_SEXT;
- assert(empty(OpdMapper.getVRegs(1)));
+ assert(OpdMapper.getVRegs(1).empty());
MachineIRBuilder B(MI);
const RegisterBank *SrcBank =
// Make sure no potentially eflags clobbering phi moves can be inserted in
// between.
- auto HasPhis = [](const BasicBlock *Succ) {
- return !llvm::empty(Succ->phis());
- };
+ auto HasPhis = [](const BasicBlock *Succ) { return !Succ->phis().empty(); };
if (I->isTerminator() && llvm::any_of(successors(I), HasPhis))
return false;
if (L.contains(Succ))
continue;
- Info.PathIsNoop &= llvm::empty(Succ->phis()) &&
+ Info.PathIsNoop &= Succ->phis().empty() &&
(!Info.ExitForPath || Info.ExitForPath == Succ);
if (!Info.PathIsNoop)
break;
for (auto &Sec : G.sections()) {
LLVM_DEBUG({
dbgs() << " Section \"" << Sec.getName() << "\": "
- << (llvm::empty(Sec.symbols()) ? "empty. skipping."
- : "processing...")
+ << (Sec.symbols().empty() ? "empty. skipping." : "processing...")
<< "\n";
});
// Skip empty sections.
- if (llvm::empty(Sec.symbols()))
+ if (Sec.symbols().empty())
continue;
if (FileInfo.SectionInfos.count(Sec.getName()))
for (auto &Sec : G.sections()) {
LLVM_DEBUG({
dbgs() << " Section \"" << Sec.getName() << "\": "
- << (llvm::empty(Sec.symbols()) ? "empty. skipping."
- : "processing...")
+ << (Sec.symbols().empty() ? "empty. skipping." : "processing...")
<< "\n";
});
// Skip empty sections.
- if (llvm::empty(Sec.symbols()))
+ if (Sec.symbols().empty())
continue;
if (FileInfo.SectionInfos.count(Sec.getName()))
for (auto &Sec : G.sections()) {
LLVM_DEBUG({
dbgs() << " Section \"" << Sec.getName() << "\": "
- << (llvm::empty(Sec.symbols()) ? "empty. skipping."
- : "processing...")
+ << (Sec.symbols().empty() ? "empty. skipping." : "processing...")
<< "\n";
});
// Skip empty sections.
- if (llvm::empty(Sec.symbols()))
+ if (Sec.symbols().empty())
continue;
if (FileInfo.SectionInfos.count(Sec.getName()))
Sections.push_back(&S);
llvm::sort(Sections, [](const Section *LHS, const Section *RHS) {
- if (llvm::empty(LHS->symbols()) && llvm::empty(RHS->symbols()))
+ if (LHS->symbols().empty() && RHS->symbols().empty())
return false;
- if (llvm::empty(LHS->symbols()))
+ if (LHS->symbols().empty())
return false;
- if (llvm::empty(RHS->symbols()))
+ if (RHS->symbols().empty())
return true;
SectionRange LHSRange(*LHS);
SectionRange RHSRange(*RHS);
for (auto *S : Sections) {
OS << S->getName() << " content:";
- if (llvm::empty(S->symbols())) {
+ if (S->symbols().empty()) {
OS << "\n section empty\n";
continue;
}