Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h b/linux-x64/clang/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
index a6c1259..f1768a1 100644
--- a/linux-x64/clang/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
+++ b/linux-x64/clang/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
@@ -10,7 +10,10 @@
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/DataExtractor.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
#include <cstdint>
namespace llvm {
@@ -18,6 +21,51 @@
class raw_ostream;
class DWARFDebugMacro {
+ /// DWARFv5 section 6.3.1 Macro Information Header.
+ enum HeaderFlagMask {
+#define HANDLE_MACRO_FLAG(ID, NAME) MACRO_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ };
+ struct MacroHeader {
+ /// Macro version information number.
+ uint16_t Version = 0;
+
+ /// The bits of the flags field are interpreted as a set of flags, some of
+ /// which may indicate that additional fields follow. The following flags,
+ /// beginning with the least significant bit, are defined:
+ /// offset_size_flag:
+ /// If the offset_size_flag is zero, the header is for a 32-bit DWARF
+ /// format macro section and all offsets are 4 bytes long; if it is one,
+ /// the header is for a 64-bit DWARF format macro section and all offsets
+ /// are 8 bytes long.
+ /// debug_line_offset_flag:
+ /// If the debug_line_offset_flag is one, the debug_line_offset field (see
+ /// below) is present. If zero, that field is omitted.
+ /// opcode_operands_table_flag:
+ /// If the opcode_operands_table_flag is one, the opcode_operands_table
+ /// field (see below) is present. If zero, that field is omitted.
+ uint8_t Flags = 0;
+
+ /// debug_line_offset
+ /// An offset in the .debug_line section of the beginning of the line
+ /// number information in the containing compilation unit, encoded as a
+ /// 4-byte offset for a 32-bit DWARF format macro section and an 8-byte
+ /// offset for a 64-bit DWARF format macro section.
+ uint64_t DebugLineOffset;
+
+ /// Print the macro header from the debug_macro section.
+ void dumpMacroHeader(raw_ostream &OS) const;
+
+ /// Parse the debug_macro header.
+ Error parseMacroHeader(DWARFDataExtractor Data, uint64_t *Offset);
+
+ /// Get the DWARF format according to the flags.
+ dwarf::DwarfFormat getDwarfFormat() const;
+
+ /// Get the size of a reference according to the DWARF format.
+ uint8_t getOffsetByteSize() const;
+ };
+
/// A single macro entry within a macro list.
struct Entry {
/// The type of the macro entry.
@@ -27,6 +75,8 @@
uint64_t Line;
/// Vendor extension constant value.
uint64_t ExtConstant;
+ /// Macro unit import offset.
+ uint64_t ImportOffset;
};
union {
@@ -39,22 +89,46 @@
};
};
- using MacroList = SmallVector<Entry, 4>;
+ struct MacroList {
+ // A value 0 in the `Header.Version` field indicates that we're parsing
+ // a macinfo[.dwo] section which doesn't have header itself, hence
+ // for that case other fields in the `Header` are uninitialized.
+ MacroHeader Header;
+ SmallVector<Entry, 4> Macros;
+ uint64_t Offset;
+
+ /// Whether or not this is a .debug_macro section.
+ bool IsDebugMacro;
+ };
/// A list of all the macro entries in the debug_macinfo section.
- MacroList Macros;
+ std::vector<MacroList> MacroLists;
public:
DWARFDebugMacro() = default;
- /// Print the macro list found within the debug_macinfo section.
+ /// Print the macro list found within the debug_macinfo/debug_macro section.
void dump(raw_ostream &OS) const;
- /// Parse the debug_macinfo section accessible via the 'data' parameter.
- void parse(DataExtractor data);
+ Error parseMacro(DWARFUnitVector::compile_unit_range Units,
+ DataExtractor StringExtractor,
+ DWARFDataExtractor MacroData) {
+ return parseImpl(Units, StringExtractor, MacroData, /*IsMacro=*/true);
+ }
+
+ Error parseMacinfo(DWARFDataExtractor MacroData) {
+ return parseImpl(None, None, MacroData, /*IsMacro=*/false);
+ }
/// Return whether the section has any entries.
- bool empty() const { return Macros.empty(); }
+ bool empty() const { return MacroLists.empty(); }
+
+private:
+ /// Parse the debug_macinfo/debug_macro section accessible via the 'MacroData'
+ /// parameter.
+ Error parseImpl(Optional<DWARFUnitVector::compile_unit_range> Units,
+ Optional<DataExtractor> StringExtractor,
+ DWARFDataExtractor Data, bool IsMacro);
};
} // end namespace llvm