Revert "[llvm-cov] Warn when -arch spec is missing/invalid for universal binary"

This reverts commit b81d4bfb44.

It's causing some bots to fail to build due to: "error: no matching
function for call to ‘__iterator_category".
This commit is contained in:
Vedant Kumar 2020-10-13 16:32:31 -07:00
parent b81d4bfb44
commit 10b6d0901f
4 changed files with 2 additions and 22 deletions

View File

@ -55,8 +55,7 @@ enum class coveragemap_error {
unsupported_version,
truncated,
malformed,
decompression_failed,
invalid_or_missing_arch_specifier
decompression_failed
};
const std::error_category &coveragemap_category();

View File

@ -816,8 +816,6 @@ static std::string getCoverageMapErrString(coveragemap_error Err) {
return "Malformed coverage data";
case coveragemap_error::decompression_failed:
return "Failed to decompress coverage data (zlib)";
case coveragemap_error::invalid_or_missing_arch_specifier:
return "`-arch` specifier is invalid or missing for universal binary";
}
llvm_unreachable("A value of coveragemap_error has no message.");
}

View File

@ -950,18 +950,6 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch) {
BytesInAddress, Endian);
}
/// Determine whether \p Arch is invalid or empty, given \p Bin.
static bool isArchSpecifierInvalidOrMissing(Binary *Bin, StringRef Arch) {
// If we have a universal binary and Arch doesn't identify any of its slices,
// it's user error.
if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin))
return none_of(Universal->objects(),
[Arch](const MachOUniversalBinary::ObjectForArch &Obj) {
return Obj.getArchFlagName() == Arch;
});
return false;
}
Expected<std::vector<std::unique_ptr<BinaryCoverageReader>>>
BinaryCoverageReader::create(
MemoryBufferRef ObjectBuffer, StringRef Arch,
@ -982,10 +970,6 @@ BinaryCoverageReader::create(
return BinOrErr.takeError();
std::unique_ptr<Binary> Bin = std::move(BinOrErr.get());
if (isArchSpecifierInvalidOrMissing(Bin.get(), Arch))
return make_error<CoverageMapError>(
coveragemap_error::invalid_or_missing_arch_specifier);
// MachO universal binaries which contain archives need to be treated as
// archives, not as regular binaries.
if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin.get())) {

View File

@ -10,9 +10,8 @@ int main(int argc, const char *argv[]) {}
// COMBINED: showTemplateInstantiations.cpp
// COMBINED-NEXT: universal-binary.c
// RUN: not llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -path-equivalence=/tmp,%S %s 2>&1 | FileCheck --check-prefix=WRONG-ARCH %s
// RUN: not llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -path-equivalence=/tmp,%S %s -arch i386 2>&1 | FileCheck --check-prefix=WRONG-ARCH %s
// WRONG-ARCH: Failed to load coverage: `-arch` specifier is invalid or missing for universal binary
// WRONG-ARCH: Failed to load coverage
// RUN: not llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -path-equivalence=/tmp,%S %s -arch definitly_a_made_up_architecture 2>&1 | FileCheck --check-prefix=MADE-UP-ARCH %s
// MADE-UP-ARCH: Unknown architecture: definitly_a_made_up_architecture