LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/CodeView - Formatters.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 9 12 75.0 %
Date: 2018-10-20 13:21:21 Functions: 1 2 50.0 %
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          16 : 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        6057 :   static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
      53             :                      StringRef Style) {
      54        6057 :     if (V.isNoneType())
      55        1036 :       Stream << "<no type>";
      56             :     else {
      57       10042 :       Stream << formatv("{0:X+4}", V.getIndex());
      58        5021 :       if (V.isSimple())
      59         635 :         Stream << " (" << codeview::TypeIndex::simpleTypeName(V) << ")";
      60             :     }
      61        6057 :   }
      62             : };
      63             : 
      64             : template <> struct format_provider<codeview::GUID> {
      65           0 :   static void format(const codeview::GUID &V, llvm::raw_ostream &Stream,
      66             :                      StringRef Style) {
      67           0 :     Stream << V;
      68           0 :   }
      69             : };
      70             : 
      71             : } // end namespace llvm
      72             : 
      73             : #endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H

Generated by: LCOV version 1.13