Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/PDB/GenericError.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- Error.cpp - system_error extensions for PDB --------------*- 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/PDB/GenericError.h"
10
#include "llvm/Support/ErrorHandling.h"
11
#include "llvm/Support/ManagedStatic.h"
12
13
using namespace llvm;
14
using namespace llvm::pdb;
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 PDBErrorCategory : public std::error_category {
21
public:
22
0
  const char *name() const noexcept override { return "llvm.pdb"; }
23
2
  std::string message(int Condition) const override {
24
2
    switch (static_cast<pdb_error_code>(Condition)) {
25
2
    case pdb_error_code::unspecified:
26
0
      return "An unknown error has occurred.";
27
2
    case pdb_error_code::dia_sdk_not_present:
28
0
      return "LLVM was not compiled with support for DIA. This usually means "
29
0
             "that you are not using MSVC, or your Visual Studio "
30
0
             "installation is corrupt.";
31
2
    case pdb_error_code::dia_failed_loading:
32
0
      return "DIA is only supported when using MSVC.";
33
2
    case pdb_error_code::invalid_utf8_path:
34
0
      return "The PDB file path is an invalid UTF8 sequence.";
35
2
    case pdb_error_code::signature_out_of_date:
36
2
      return "The signature does not match; the file(s) might be out of date.";
37
2
    case pdb_error_code::external_cmdline_ref:
38
0
      return "The path to this file must be provided on the command-line.";
39
0
    }
40
0
    llvm_unreachable("Unrecognized generic_error_code");
41
0
  }
42
};
43
} // namespace
44
45
static llvm::ManagedStatic<PDBErrorCategory> PDBCategory;
46
2
const std::error_category &llvm::pdb::PDBErrCategory() { return *PDBCategory; }
47
48
char PDBError::ID;