Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
Line
Count
Source
1
//===- DWARFDebugMacro.h ----------------------------------------*- 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
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
10
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
11
12
#include "llvm/ADT/SmallVector.h"
13
#include "llvm/Support/DataExtractor.h"
14
#include <cstdint>
15
16
namespace llvm {
17
18
class raw_ostream;
19
20
class DWARFDebugMacro {
21
  /// A single macro entry within a macro list.
22
  struct Entry {
23
    /// The type of the macro entry.
24
    uint32_t Type;
25
    union {
26
      /// The source line where the macro is defined.
27
      uint64_t Line;
28
      /// Vendor extension constant value.
29
      uint64_t ExtConstant;
30
    };
31
32
    union {
33
      /// The string (name, value) of the macro entry.
34
      const char *MacroStr;
35
      // An unsigned integer indicating the identity of the source file.
36
      uint64_t File;
37
      /// Vendor extension string.
38
      const char *ExtStr;
39
    };
40
  };
41
42
  using MacroList = SmallVector<Entry, 4>;
43
44
  /// A list of all the macro entries in the debug_macinfo section.
45
  MacroList Macros;
46
47
public:
48
214
  DWARFDebugMacro() = default;
49
50
  /// Print the macro list found within the debug_macinfo section.
51
  void dump(raw_ostream &OS) const;
52
53
  /// Parse the debug_macinfo section accessible via the 'data' parameter.
54
  void parse(DataExtractor data);
55
56
  /// Return whether the section has any entries.
57
213
  bool empty() const { return Macros.empty(); }
58
};
59
60
} // end namespace llvm
61
62
#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H