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