InstrProf: Give coverage its own errors instead of piggy backing on instrprof

Since the coverage mapping reader and the instrprof reader were
emitting a shared set of error codes, the error messages you'd get
back from llvm-cov were ambiguous about what was actually wrong. Add
another error category to fix this.

I've also improved the wording on a couple of the instrprof errors,
for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236665 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner
2015-05-06 23:19:35 +00:00
parent 63134e79e6
commit 406a47c17f
5 changed files with 84 additions and 34 deletions

View File

@@ -484,7 +484,26 @@ template<> struct DenseMapInfo<coverage::CounterExpression> {
}
};
const std::error_category &coveragemap_category();
enum class coveragemap_error {
success = 0,
eof,
no_data_found,
unsupported_version,
truncated,
malformed
};
inline std::error_code make_error_code(coveragemap_error E) {
return std::error_code(static_cast<int>(E), coveragemap_category());
}
} // end namespace llvm
namespace std {
template <>
struct is_error_code_enum<llvm::coveragemap_error> : std::true_type {};
}
#endif // LLVM_PROFILEDATA_COVERAGEMAPPING_H_