[llvm] [llvm-cov] - Output better error message when the error kind is `coveragemap_error::malforme`. (PR #65264)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 09:29:16 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";
----------------
MaskRay wrote:

It seems that most message are untested?

Note, the diagnostic formatting follows Clang. We don't use capitalization: https://llvm.org/docs/CodingStandards.html#error-and-warning-messages

https://github.com/llvm/llvm-project/pull/65264


More information about the llvm-commits mailing list