[llvm] [llvm-readobj][COFF] Dump .modmeta section (PR #201695)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 06:23:43 PDT 2026


================
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Object/COFFCxxModuleMetadata.h"
+#include "llvm/Support/ErrorExtras.h"
+
+namespace llvm::object {
+
+COFFCxxModuleMetadataReader::COFFCxxModuleMetadataReader(
+    const COFFCxxModuleMetadata &Map)
+    : ModuleData(Map.ModuleData), NamesData(Map.NamesData),
+      ModuleIndexWidth(Map.ModuleIndexWidth),
+      SymbolIndexWidth(Map.SymbolIndexWidth) {}
+
+bool COFFCxxModuleMetadataReader::hasModuleData() const {
+  return !ModuleData.empty();
+}
+
+Expected<uint32_t> COFFCxxModuleMetadataReader::readModuleID() {
+  switch (ModuleIndexWidth) {
+  case 1: {
+    if (ModuleData.size() < 1)
+      return createStringError("Not enough data");
----------------
Nerixyz wrote:

Done. Though I flipped the if-statement.

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


More information about the llvm-commits mailing list