[llvm-branch-commits] [llvm] [GOFF] Add writing of text records (PR #137235)

Ulrich Weigand via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 30 09:17:22 PDT 2025


================
@@ -688,28 +689,32 @@ MCSectionGOFF *MCContext::getGOFFSection(SectionKind Kind, StringRef Name,
     return Iter->second;
 
   StringRef CachedName = StringRef(Iter->first.c_str(), Name.size());
-  MCSectionGOFF *GOFFSection = new (GOFFAllocator.Allocate()) MCSectionGOFF(
-      CachedName, Kind, Attributes, static_cast<MCSectionGOFF *>(Parent));
+  MCSectionGOFF *GOFFSection = new (GOFFAllocator.Allocate())
+      MCSectionGOFF(CachedName, Kind, IsVirtual, Attributes,
+                    static_cast<MCSectionGOFF *>(Parent));
   Iter->second = GOFFSection;
   allocInitialFragment(*GOFFSection);
   return GOFFSection;
 }
 
 MCSectionGOFF *MCContext::getGOFFSection(SectionKind Kind, StringRef Name,
                                          GOFF::SDAttr SDAttributes) {
-  return getGOFFSection<GOFF::SDAttr>(Kind, Name, SDAttributes, nullptr);
+  return getGOFFSection<GOFF::SDAttr>(Kind, Name, SDAttributes, nullptr,
+                                      /*IsVirtual=*/true);
 }
 
 MCSectionGOFF *MCContext::getGOFFSection(SectionKind Kind, StringRef Name,
                                          GOFF::EDAttr EDAttributes,
-                                         MCSection *Parent) {
-  return getGOFFSection<GOFF::EDAttr>(Kind, Name, EDAttributes, Parent);
+                                         MCSection *Parent, bool IsVirtual) {
+  return getGOFFSection<GOFF::EDAttr>(Kind, Name, EDAttributes, Parent,
+                                      IsVirtual);
----------------
uweigand wrote:

Can we deduce the `IsVirtual` property from `EDAttributes.BindAlgorithm == GOFF::ESD_BA_Merge` here?  Having to explicitly specific it with every caller seems error-prone.

https://github.com/llvm/llvm-project/pull/137235


More information about the llvm-branch-commits mailing list