Fix several accidental DOS line endings in source files
[oota-llvm.git] / include / llvm / DebugInfo / DWARF / DWARFDebugMacro.h
1 //===-- DWARFDebugMacro.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_DWARF_DWARFDEBUGMACRO_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
12
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/DataExtractor.h"
16 #include "llvm/Support/Dwarf.h"
17
18 namespace llvm {
19
20 class raw_ostream;
21
22 class DWARFDebugMacro {
23   /// A single macro entry within a macro list.
24   struct Entry {
25     /// The type of the macro entry.
26     uint32_t Type;
27     union {
28       /// The source line where the macro is defined.
29       uint64_t Line;
30       /// Vendor extension constant value.
31       uint64_t ExtConstant;
32     };
33
34     union {
35       /// The string (name, value) of the macro entry.
36       const char *MacroStr;
37       // An unsigned integer indicating the identity of the source file.
38       uint64_t File;
39       /// Vendor extension string.
40       const char *ExtStr;
41     };
42   };
43
44   typedef SmallVector<Entry, 4> MacroList;
45
46   /// A list of all the macro entries in the debug_macinfo section.
47   MacroList Macros;
48
49 public:
50   DWARFDebugMacro() {}
51   /// Print the macro list found within the debug_macinfo section.
52   void dump(raw_ostream &OS) const;
53   /// Parse the debug_macinfo section accessible via the 'data' parameter.
54   void parse(DataExtractor data);
55 };
56
57 }
58
59 #endif