[InstCombine] Signed saturation patterns
[llvm-core.git] / include / llvm / DebugInfo / DWARF / DWARFDebugMacro.h
bloba6c125990ca7aa06ea89ad70d60222403165ba88
1 //===- DWARFDebugMacro.h ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/Support/DataExtractor.h"
14 #include <cstdint>
16 namespace llvm {
18 class raw_ostream;
20 class DWARFDebugMacro {
21 /// A single macro entry within a macro list.
22 struct Entry {
23 /// The type of the macro entry.
24 uint32_t Type;
25 union {
26 /// The source line where the macro is defined.
27 uint64_t Line;
28 /// Vendor extension constant value.
29 uint64_t ExtConstant;
32 union {
33 /// The string (name, value) of the macro entry.
34 const char *MacroStr;
35 // An unsigned integer indicating the identity of the source file.
36 uint64_t File;
37 /// Vendor extension string.
38 const char *ExtStr;
42 using MacroList = SmallVector<Entry, 4>;
44 /// A list of all the macro entries in the debug_macinfo section.
45 MacroList Macros;
47 public:
48 DWARFDebugMacro() = default;
50 /// Print the macro list found within the debug_macinfo section.
51 void dump(raw_ostream &OS) const;
53 /// Parse the debug_macinfo section accessible via the 'data' parameter.
54 void parse(DataExtractor data);
56 /// Return whether the section has any entries.
57 bool empty() const { return Macros.empty(); }
60 } // end namespace llvm
62 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H