[lld] [llvm] [WebAssembly][Object] Support more elem segment flags (PR #123427)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 16:16:56 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 72225ca27f561b74da292433400f250592d73b13 a6f60fc120e856d805c5f99278c46cca81950a37 --extensions h,cpp -- lld/wasm/SyntheticSections.cpp llvm/include/llvm/BinaryFormat/Wasm.h llvm/lib/MC/WasmObjectWriter.cpp llvm/lib/Object/WasmObjectFile.cpp llvm/lib/ObjectYAML/WasmEmitter.cpp llvm/lib/ObjectYAML/WasmYAML.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h
index 19097b458f..ede2d692a5 100644
--- a/llvm/include/llvm/BinaryFormat/Wasm.h
+++ b/llvm/include/llvm/BinaryFormat/Wasm.h
@@ -417,11 +417,7 @@ struct WasmDataSegment {
 
 // 3 different element segment modes are encodable. This class is currently
 // only used during decoding (see WasmElemSegment below).
-enum class ElemSegmentMode {
-  Active,
-  Passive,
-  Declarative
-};
+enum class ElemSegmentMode { Active, Passive, Declarative };
 
 // Represents a Wasm element segment, with some limitations compared the spec:
 // 1) Does not model passive or declarative segments (Segment will end up with
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index beed577481..0f6fd5612f 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -1664,8 +1664,9 @@ Error WasmObjectFile::parseElemSection(ReadContext &Ctx) {
     bool HasElemKind =
         (Segment.Flags & wasm::WASM_ELEM_SEGMENT_MASK_HAS_ELEM_DESC) &&
         !(Segment.Flags & wasm::WASM_ELEM_SEGMENT_HAS_INIT_EXPRS);
-    bool HasElemType = (Segment.Flags & wasm::WASM_ELEM_SEGMENT_MASK_HAS_ELEM_DESC) &&
-                       (Segment.Flags & wasm::WASM_ELEM_SEGMENT_HAS_INIT_EXPRS);
+    bool HasElemType =
+        (Segment.Flags & wasm::WASM_ELEM_SEGMENT_MASK_HAS_ELEM_DESC) &&
+        (Segment.Flags & wasm::WASM_ELEM_SEGMENT_HAS_INIT_EXPRS);
     bool HasInitExprs =
         (Segment.Flags & wasm::WASM_ELEM_SEGMENT_HAS_INIT_EXPRS);
 

``````````

</details>


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


More information about the llvm-commits mailing list