[PATCH] D73039: [DWARF] Make dwarf::getDwarfOffsetByteSize() a free function. NFC.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 05:49:28 PST 2020
ikudrin created this revision.
ikudrin added reviewers: probinson, dblaikie, aprantl.
ikudrin added projects: debug-info, LLVM.
This will help simplify code in upcoming patches and make some expressions `constexpr`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73039
Files:
llvm/include/llvm/BinaryFormat/Dwarf.h
Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===================================================================
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -532,6 +532,17 @@
Optional<unsigned> LanguageLowerBound(SourceLanguage L);
+/// The size of a reference determined by the DWARF 32/64-bit format.
+constexpr uint8_t getDwarfOffsetByteSize(DwarfFormat Format) {
+ switch (Format) {
+ case DwarfFormat::DWARF32:
+ return 4;
+ case DwarfFormat::DWARF64:
+ return 8;
+ }
+ llvm_unreachable("Invalid Format value");
+}
+
/// A helper struct providing information about the byte size of DW_FORM
/// values that vary in size depending on the DWARF version, address byte
/// size, or DWARF32/DWARF64.
@@ -551,13 +562,7 @@
/// The size of a reference is determined by the DWARF 32/64-bit format.
uint8_t getDwarfOffsetByteSize() const {
- switch (Format) {
- case DwarfFormat::DWARF32:
- return 4;
- case DwarfFormat::DWARF64:
- return 8;
- }
- llvm_unreachable("Invalid Format value");
+ return dwarf::getDwarfOffsetByteSize(Format);
}
explicit operator bool() const { return Version && AddrSize; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73039.239091.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200120/92509dde/attachment.bin>
More information about the llvm-commits
mailing list