[compiler-rt] Add more diagnostic to InstrProfError
authorGulfem Savrun Yeniceri <gulfem@google.com>
Mon, 30 Aug 2021 19:12:16 +0000 (19:12 +0000)
committerGulfem Savrun Yeniceri <gulfem@google.com>
Tue, 9 Nov 2021 18:04:12 +0000 (18:04 +0000)
commitee88b8d63e475a75ae525563edfa95f6fcaac83a
treececb7658fd07afba839372a218d8a6e56f1bdd12
parent1e78d5d008f95b47834ce2438a9b0faf96c85985
[compiler-rt] Add more diagnostic to InstrProfError

If profile data is malformed for any kind of reason, we generate
an error that only reports "malformed instrumentation profile data"
without any further information. This patch extends InstrProfError
class to receive an optional error message argument, so that we can
do better error reporting.

Differential Revision: https://reviews.llvm.org/D108942
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/test/tools/llvm-profdata/large-binary-id-size.test
llvm/test/tools/llvm-profdata/malformed-not-space-for-another-header.test [new file with mode: 0644]
llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test [new file with mode: 0644]
llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test