[PATCH] D104027: [lld/mac] Use sectionType() more

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 05:59:16 PDT 2021


thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: int3.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.

Not sure sectionType() carries its weight, but while we have it
we should use it consistently.

No behavior change.


https://reviews.llvm.org/D104027

Files:
  lld/MachO/ConcatOutputSection.cpp
  lld/MachO/InputSection.cpp


Index: lld/MachO/InputSection.cpp
===================================================================
--- lld/MachO/InputSection.cpp
+++ lld/MachO/InputSection.cpp
@@ -128,7 +128,7 @@
 }
 
 bool macho::isCodeSection(const InputSection *isec) {
-  uint32_t type = isec->flags & SECTION_TYPE;
+  uint32_t type = sectionType(isec->flags);
   if (type != S_REGULAR && type != S_COALESCED)
     return false;
 
Index: lld/MachO/ConcatOutputSection.cpp
===================================================================
--- lld/MachO/ConcatOutputSection.cpp
+++ lld/MachO/ConcatOutputSection.cpp
@@ -339,8 +339,8 @@
 // are actually merged. The logic presented here was written without
 // any form of informed research.
 void ConcatOutputSection::mergeFlags(InputSection *input) {
-  uint8_t baseType = flags & SECTION_TYPE;
-  uint8_t inputType = input->flags & SECTION_TYPE;
+  uint8_t baseType = sectionType(flags);
+  uint8_t inputType = sectionType(input->flags);
   if (baseType != inputType)
     error("Cannot merge section " + input->name + " (type=0x" +
           to_hexString(inputType) + ") into " + name + " (type=0x" +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104027.351146.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/6b43495a/attachment.bin>


More information about the llvm-commits mailing list