DWARFDebugMacro.h revision 309124
1194955Strasz//===-- DWARFDebugMacro.h ---------------------------------------*- C++ -*-===//
2194955Strasz//
3194955Strasz//                     The LLVM Compiler Infrastructure
4194955Strasz//
5194955Strasz// This file is distributed under the University of Illinois Open Source
6194955Strasz// License. See LICENSE.TXT for details.
7194955Strasz//
8194955Strasz//===----------------------------------------------------------------------===//
9194955Strasz
10194955Strasz#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
11194955Strasz#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
12194955Strasz
13194955Strasz#include "llvm/ADT/SmallVector.h"
14194955Strasz#include "llvm/Support/DataExtractor.h"
15194955Strasz#include "llvm/Support/Dwarf.h"
16194955Strasz
17194955Strasznamespace llvm {
18194955Strasz
19194955Straszclass raw_ostream;
20194955Strasz
21194955Straszclass DWARFDebugMacro {
22194955Strasz  /// A single macro entry within a macro list.
23194955Strasz  struct Entry {
24194955Strasz    /// The type of the macro entry.
25194955Strasz    uint32_t Type;
26194955Strasz    union {
27194955Strasz      /// The source line where the macro is defined.
28194955Strasz      uint64_t Line;
29194955Strasz      /// Vendor extension constant value.
30194955Strasz      uint64_t ExtConstant;
31194955Strasz    };
32194955Strasz
33194955Strasz    union {
34194955Strasz      /// The string (name, value) of the macro entry.
35194955Strasz      const char *MacroStr;
36194955Strasz      // An unsigned integer indicating the identity of the source file.
37194955Strasz      uint64_t File;
38194955Strasz      /// Vendor extension string.
39194955Strasz      const char *ExtStr;
40194955Strasz    };
41194955Strasz  };
42194955Strasz
43194955Strasz  typedef SmallVector<Entry, 4> MacroList;
44194955Strasz
45194955Strasz  /// A list of all the macro entries in the debug_macinfo section.
46194955Strasz  MacroList Macros;
47194955Strasz
48194955Straszpublic:
49194955Strasz  DWARFDebugMacro() {}
50194955Strasz  /// Print the macro list found within the debug_macinfo section.
51194955Strasz  void dump(raw_ostream &OS) const;
52194955Strasz  /// Parse the debug_macinfo section accessible via the 'data' parameter.
53208811Strasz  void parse(DataExtractor data);
54194955Strasz};
55194955Strasz
56194955Strasz}
57194955Strasz
58194955Strasz#endif
59194955Strasz