LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/CodeView - Formatters.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 10 10 100.0 %
Date: 2017-09-14 15:23:50 Functions: 1 3 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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          88 : 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           4 :   return detail::GuidAdapter(Item);
      46             : }
      47             : 
      48             : } // end namespace codeview
      49             : 
      50             : template <> struct format_provider<codeview::TypeIndex> {
      51             : public:
      52        1620 :   static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
      53             :                      StringRef Style) {
      54        1620 :     if (V.isNoneType())
      55         190 :       Stream << "<no type>";
      56             :     else {
      57        4290 :       Stream << formatv("{0:X+4}", V.getIndex());
      58        1430 :       if (V.isSimple())
      59         209 :         Stream << " (" << codeview::TypeIndex::simpleTypeName(V) << ")";
      60             :     }
      61        1620 :   }
      62             : };
      63             : 
      64             : template <> struct format_provider<codeview::GUID> {
      65             :   static void format(const codeview::GUID &V, llvm::raw_ostream &Stream,
      66             :                      StringRef Style) {
      67           2 :     Stream << V;
      68             :   }
      69             : };
      70             : 
      71             : } // end namespace llvm
      72             : 
      73             : #endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H

Generated by: LCOV version 1.13