Suppress a few -Wunreachable-code warnings.

No behavior change. Also fix a comment to say match reality.
This commit is contained in:
Nico Weber 2020-03-25 13:48:02 -04:00
parent 18ad2e6d54
commit 47138b2f83
5 changed files with 23 additions and 32 deletions

View File

@ -1931,14 +1931,10 @@ Error DWARFContext::loadRegisterInfo(const object::ObjectFile &Obj) {
uint8_t DWARFContext::getCUAddrSize() {
// In theory, different compile units may have different address byte
// sizes, but for simplicity we just use the address byte size of the
// last compile unit. In practice the address size field is repeated across
// first compile unit. In practice the address size field is repeated across
// various DWARF headers (at least in version 5) to make it easier to dump
// them independently, not to enable varying the address size.
uint8_t Addr = 0;
for (const auto &CU : compile_units()) {
Addr = CU->getAddressByteSize();
break;
}
return Addr;
unit_iterator_range CUs = compile_units();
return CUs.empty() ? 0 : (*CUs.begin())->getAddressByteSize();
}

View File

@ -450,10 +450,8 @@ template <> struct MappingTraits<const InterfaceFile *> {
if (File->isInstallAPI())
Flags |= TBDFlags::InstallAPI;
for (const auto &Iter : File->umbrellas()) {
ParentUmbrella = Iter.second;
break;
}
if (!File->umbrellas().empty())
ParentUmbrella = File->umbrellas().begin()->second;
std::set<ArchitectureSet> ArchSet;
for (const auto &Library : File->allowableClients())

View File

@ -763,7 +763,6 @@ static void extractSlice(ArrayRef<OwningBinary<Binary>> InputBinaries,
reportError("input file " +
InputBinaries.front().getBinary()->getFileName() +
" must be a fat file when the -extract option is specified");
exit(EXIT_FAILURE);
}
SmallVector<std::unique_ptr<MachOObjectFile>, 2> ExtractedObjects;

View File

@ -423,7 +423,7 @@ int main() {
}
std::cout << " 0\n};\n";
if (0) {
LLVM_DEBUG({
// Print out the table.
for (unsigned i = 0; i != 0x8889; ++i) {
if (!isValidMask(i)) continue;
@ -440,7 +440,7 @@ int main() {
std::cerr << "\n";
}
}
}
})
}

View File

@ -1082,15 +1082,14 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) {
for (Record *RWD : RWDefs) {
if (RWD->getValueAsDef("SchedModel") == RWModelDef &&
RWModelDef->getValueAsBit("FullInstRWOverlapCheck")) {
for (Record *Inst : InstDefs) {
PrintFatalError
(InstRWDef->getLoc(),
"Overlapping InstRW definition for \"" +
Inst->getName() +
"\" also matches previous \"" +
RWD->getValue("Instrs")->getValue()->getAsString() +
"\".");
}
assert(!InstDefs.empty()); // Checked at function start.
PrintFatalError
(InstRWDef->getLoc(),
"Overlapping InstRW definition for \"" +
InstDefs.front()->getName() +
"\" also matches previous \"" +
RWD->getValue("Instrs")->getValue()->getAsString() +
"\".");
}
}
LLVM_DEBUG(dbgs() << "InstRW: Reuse SC " << OldSCIdx << ":"
@ -1118,15 +1117,14 @@ void CodeGenSchedModels::createInstRWClass(Record *InstRWDef) {
Record *RWModelDef = InstRWDef->getValueAsDef("SchedModel");
for (Record *OldRWDef : SchedClasses[OldSCIdx].InstRWs) {
if (OldRWDef->getValueAsDef("SchedModel") == RWModelDef) {
for (Record *InstDef : InstDefs) {
PrintFatalError
(InstRWDef->getLoc(),
"Overlapping InstRW definition for \"" +
InstDef->getName() +
"\" also matches previous \"" +
OldRWDef->getValue("Instrs")->getValue()->getAsString() +
"\".");
}
assert(!InstDefs.empty()); // Checked at function start.
PrintFatalError
(InstRWDef->getLoc(),
"Overlapping InstRW definition for \"" +
InstDefs.front()->getName() +
"\" also matches previous \"" +
OldRWDef->getValue("Instrs")->getValue()->getAsString() +
"\".");
}
assert(OldRWDef != InstRWDef &&
"SchedClass has duplicate InstRW def");