Coverage Report

Created: 2018-09-19 08:35

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/DebugInfo/CodeView/Formatters.h
Line
Count
Source (jump to first uncovered line)
1
//===- Formatters.h ---------------------------------------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
11
#define LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
12
13
#include "llvm/ADT/ArrayRef.h"
14
#include "llvm/ADT/StringRef.h"
15
#include "llvm/DebugInfo/CodeView/GUID.h"
16
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
17
#include "llvm/Support/FormatAdapters.h"
18
#include "llvm/Support/FormatVariadic.h"
19
#include "llvm/Support/raw_ostream.h"
20
#include <cstdint>
21
22
namespace llvm {
23
24
namespace codeview {
25
26
namespace detail {
27
28
class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
29
  ArrayRef<uint8_t> Guid;
30
31
public:
32
  explicit GuidAdapter(ArrayRef<uint8_t> Guid);
33
  explicit GuidAdapter(StringRef Guid);
34
35
  void format(raw_ostream &Stream, StringRef Style) override;
36
};
37
38
} // end namespace detail
39
40
inline detail::GuidAdapter fmt_guid(StringRef Item) {
41
  return detail::GuidAdapter(Item);
42
}
43
44
inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
45
  return detail::GuidAdapter(Item);
46
}
47
48
} // end namespace codeview
49
50
template <> struct format_provider<codeview::TypeIndex> {
51
public:
52
  static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
53
                     StringRef Style) {
54
    if (V.isNoneType())
55
      Stream << "<no type>";
56
    else {
57
      Stream << formatv("{0:X+4}", V.getIndex());
58
      if (V.isSimple())
59
        Stream << " (" << codeview::TypeIndex::simpleTypeName(V) << ")";
60
    }
61
  }
62
};
63
64
template <> struct format_provider<codeview::GUID> {
65
  static void format(const codeview::GUID &V, llvm::raw_ostream &Stream,
66
0
                     StringRef Style) {
67
0
    Stream << V;
68
0
  }
69
};
70
71
} // end namespace llvm
72
73
#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H