[llvm] [llvm-cov] - Output better error message when the error kind is `coveragemap_error::malforme`. (PR #65264)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 03:08:14 PDT 2023
================
@@ -925,26 +926,45 @@ LineCoverageIterator &LineCoverageIterator::operator++() {
return *this;
}
-static std::string getCoverageMapErrString(coveragemap_error Err) {
+static std::string getCoverageMapErrString(coveragemap_error Err,
+ const std::string &ErrMsg = "") {
+ std::string Msg;
+ raw_string_ostream OS(Msg);
+
switch (Err) {
case coveragemap_error::success:
- return "Success";
+ OS << "Success";
----------------
MaggieYingYi wrote:
> It seems that most message are untested?
>
Yes, there is only one unittest for coveragemap_error::malformed error although there are different cases of malformed coverage data error. The coveragemap_error::malformed error is only tested in the llvm-cov unittest. The patch is mainly focus on adding additional error message to the existing coverage error and didn't change the conditions of causing the malformed coverage data error. Therefore, I only used the existing unittest to make sure the additional error is given in the outputted error message. The same case happens in the llvm-profdate test for instrprof_error::malformed.
> Note, the diagnostic formatting follows Clang. We don't use capitalization: https://llvm.org/docs/CodingStandards.html#error-and-warning-messages
Fixed, thanks.
https://github.com/llvm/llvm-project/pull/65264
More information about the llvm-commits
mailing list