f7910962a03ff179dc4679417d178eafa1bb2345
[oota-llvm.git] / include / llvm / DebugInfo / DWARF / DWARFDebugMacro.h
1 //===-- DWARFDebugMacro.h ---------------------------------------*- C++ -*-===//\r
2 //\r
3 //                     The LLVM Compiler Infrastructure\r
4 //\r
5 // This file is distributed under the University of Illinois Open Source\r
6 // License. See LICENSE.TXT for details.\r
7 //\r
8 //===----------------------------------------------------------------------===//\r
9 \r
10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H\r
11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H\r
12 \r
13 #include "llvm/ADT/SmallVector.h"\r
14 #include "llvm/ADT/StringRef.h"\r
15 #include "llvm/Support/DataExtractor.h"\r
16 #include "llvm/Support/Dwarf.h"\r
17 \r
18 namespace llvm {\r
19 \r
20 class raw_ostream;\r
21 \r
22 class DWARFDebugMacro {\r
23   /// A single macro entry within a macro list.\r
24   struct Entry {\r
25     /// The type of the macro entry.\r
26     uint32_t Type;\r
27     union {\r
28       /// The source line where the macro is defined.\r
29       uint64_t Line;\r
30       /// Vendor extension constant value.\r
31       uint64_t ExtConstant;\r
32     };\r
33 \r
34     union {\r
35       /// The string (name, value) of the macro entry.\r
36       const char *MacroStr;\r
37       // An unsigned integer indicating the identity of the source file.\r
38       uint64_t File;\r
39       /// Vendor extension string.\r
40       const char *ExtStr;\r
41     };\r
42   };\r
43 \r
44   typedef SmallVector<Entry, 4> MacroList;\r
45 \r
46   /// A list of all the macro entries in the debug_macinfo section.\r
47   MacroList Macros;\r
48 \r
49 public:\r
50   DWARFDebugMacro() {}\r
51   /// Print the macro list found within the debug_macinfo section.\r
52   void dump(raw_ostream &OS) const;\r
53   /// Parse the debug_macinfo section accessible via the 'data' parameter.\r
54   void parse(DataExtractor data);\r
55 };\r
56 \r
57 }\r
58 \r
59 #endif\r