[PATCH] D79136: [XCOFF] Clean-up enum use in BinaryFormat/XCOFF.h; NFC

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 18:08:08 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d806e254e81: [XCOFF] Clean-up enum use in BinaryFormat/XCOFF.h; NFC (authored by hubert.reinterpretcast).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79136

Files:
  llvm/include/llvm/BinaryFormat/XCOFF.h


Index: llvm/include/llvm/BinaryFormat/XCOFF.h
===================================================================
--- llvm/include/llvm/BinaryFormat/XCOFF.h
+++ llvm/include/llvm/BinaryFormat/XCOFF.h
@@ -13,7 +13,8 @@
 #ifndef LLVM_BINARYFORMAT_XCOFF_H
 #define LLVM_BINARYFORMAT_XCOFF_H
 
-#include <cstdint>
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
 class StringRef;
@@ -21,14 +22,13 @@
 namespace XCOFF {
 
 // Constants used in the XCOFF definition.
-enum {
-  FileNamePadSize = 6,
-  NameSize = 8,
-  SymbolTableEntrySize = 18,
-  RelocationSerializationSize32 = 10
-};
 
-enum ReservedSectionNum { N_DEBUG = -2, N_ABS = -1, N_UNDEF = 0 };
+constexpr size_t FileNamePadSize = 6;
+constexpr size_t NameSize = 8;
+constexpr size_t SymbolTableEntrySize = 18;
+constexpr size_t RelocationSerializationSize32 = 10;
+
+enum ReservedSectionNum : int16_t { N_DEBUG = -2, N_ABS = -1, N_UNDEF = 0 };
 
 // x_smclas field of x_csect from system header: /usr/include/syms.h
 /// Storage Mapping Class definitions.
@@ -60,9 +60,10 @@
   XMC_TE = 22  ///< Symbol mapped at the end of TOC
 };
 
-// Flags for defining the section type. Used for the s_flags field of
-// the section header structure. Defined in the system header `scnhdr.h`.
-enum SectionTypeFlags {
+// Flags for defining the section type. Masks for use with the (signed, 32-bit)
+// s_flags field of the section header structure, selecting for values in the
+// lower 16 bits. Defined in the system header `scnhdr.h`.
+enum SectionTypeFlags : int32_t {
   STYP_PAD = 0x0008,
   STYP_DWARF = 0x0010,
   STYP_TEXT = 0x0020,
@@ -147,7 +148,10 @@
   C_TCSYM = 134 // Reserved
 };
 
-enum SymbolType {
+// Flags for defining the symbol type. Values to be encoded into the lower 3
+// bits of the (unsigned, 8-bit) x_smtyp field of csect auxiliary symbol table
+// entries. Defined in the system header `syms.h`.
+enum SymbolType : uint8_t {
   XTY_ER = 0, ///< External reference.
   XTY_SD = 1, ///< Csect definition for initialized storage.
   XTY_LD = 2, ///< Label definition.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79136.261413.patch
Type: text/x-patch
Size: 2055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200501/5188dcdb/attachment.bin>


More information about the llvm-commits mailing list