[llvm-objdump] Fix type mismatch in std::min.

I broke the build just now by trying to do std::min between a size_t
and a uint64_t, which of course worked fine on my 64-bit test platform.
This commit is contained in:
Simon Tatham 2022-07-26 09:43:26 +01:00
parent 10c2bab50e
commit 1c3d0a2e87
2 changed files with 10 additions and 8 deletions

View File

@ -1128,8 +1128,8 @@ static void collectLocalBranchTargets(
bool Disassembled =
DisAsm->getInstruction(Inst, Size, ThisBytes, Index, nulls());
if (Size == 0)
Size = std::min(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, Index));
Size = std::min<uint64_t>(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, Index));
if (Disassembled && MIA) {
uint64_t Target;
@ -1175,8 +1175,8 @@ static void addSymbolizer(
ArrayRef<uint8_t> ThisBytes = Bytes.slice(Index - SectionAddr);
DisAsm->getInstruction(Inst, Size, ThisBytes, Index, nulls());
if (Size == 0)
Size = std::min(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, Index));
Size = std::min<uint64_t>(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, Index));
Index += Size;
}
ArrayRef<uint64_t> LabelAddrsRef = SymbolizerPtr->getReferencedAddresses();
@ -1648,8 +1648,9 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
bool Disassembled = DisAsm->getInstruction(Inst, Size, ThisBytes,
ThisAddr, CommentStream);
if (Size == 0)
Size = std::min(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
Size = std::min<uint64_t>(
ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
LVP.update({Index, Section.getIndex()},
{Index + Size, Section.getIndex()}, Index + Size != End);

View File

@ -787,8 +787,9 @@ static void getObjectCoveragePoints(const object::ObjectFile &O,
uint64_t ThisAddr = SectionAddr + Index;
if (!DisAsm->getInstruction(Inst, Size, ThisBytes, ThisAddr, nulls())) {
if (Size == 0)
Size = std::min(ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
Size = std::min<uint64_t>(
ThisBytes.size(),
DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
continue;
}
uint64_t Addr = Index + SectionAddr;