Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- CodeViewError.cpp - Error extensions for CodeView --------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
10
#include "llvm/Support/ErrorHandling.h"
11
#include "llvm/Support/ManagedStatic.h"
12
13
using namespace llvm;
14
using namespace llvm::codeview;
15
16
namespace {
17
// FIXME: This class is only here to support the transition to llvm::Error. It
18
// will be removed once this transition is complete. Clients should prefer to
19
// deal with the Error value directly, rather than converting to error_code.
20
class CodeViewErrorCategory : public std::error_category {
21
public:
22
0
  const char *name() const noexcept override { return "llvm.codeview"; }
23
2
  std::string message(int Condition) const override {
24
2
    switch (static_cast<cv_error_code>(Condition)) {
25
2
    case cv_error_code::unspecified:
26
0
      return "An unknown CodeView error has occurred.";
27
2
    case cv_error_code::insufficient_buffer:
28
0
      return "The buffer is not large enough to read the requested number of "
29
0
             "bytes.";
30
2
    case cv_error_code::corrupt_record:
31
2
      return "The CodeView record is corrupted.";
32
2
    case cv_error_code::no_records:
33
0
      return "There are no records.";
34
2
    case cv_error_code::operation_unsupported:
35
0
      return "The requested operation is not supported.";
36
2
    case cv_error_code::unknown_member_record:
37
0
      return "The member record is of an unknown type.";
38
0
    }
39
0
    llvm_unreachable("Unrecognized cv_error_code");
40
0
  }
41
};
42
} // namespace
43
44
static llvm::ManagedStatic<CodeViewErrorCategory> CodeViewErrCategory;
45
221
const std::error_category &llvm::codeview::CVErrorCategory() {
46
221
  return *CodeViewErrCategory;
47
221
}
48
49
char CodeViewError::ID;