[PATCH] D73039: [DWARF] Make dwarf::getDwarfOffsetByteSize() a free function. NFC.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 21:44:09 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa0f367f792ac: [DWARF] Make dwarf::getDwarfOffsetByteSize() a free function. NFC. (authored by ikudrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73039/new/

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.239774.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200123/ea5ccf93/attachment.bin>


More information about the llvm-commits mailing list