[llvm] [Support] Compact EnumEntry string storage (PR #202631)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 07:04:53 PDT 2026


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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/Object/ELFObjectFile.h llvm/include/llvm/Support/ScopedPrinter.h llvm/lib/BinaryFormat/DXContainer.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp llvm/lib/ObjectYAML/DXContainerYAML.cpp llvm/tools/llvm-objdump/COFFDump.cpp llvm/tools/llvm-readobj/ELFDumper.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 33aaf7abb..7c6198bad 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -37,8 +37,7 @@ private:
   uint16_t AltNameLength;
 
   template <size_t N> static constexpr uint16_t literalLength() {
-    static_assert(N - 1 <= UINT16_MAX,
-                  "EnumEntry names must fit in uint16_t");
+    static_assert(N - 1 <= UINT16_MAX, "EnumEntry names must fit in uint16_t");
     return N - 1;
   }
 
@@ -69,9 +68,9 @@ public:
   }
 };
 
-static_assert(sizeof(EnumEntry<uint32_t>) ==
-                  2 * sizeof(const char *) + sizeof(uint32_t) +
-                      2 * sizeof(uint16_t),
+static_assert(sizeof(EnumEntry<uint32_t>) == 2 * sizeof(const char *) +
+                                                 sizeof(uint32_t) +
+                                                 2 * sizeof(uint16_t),
               "EnumEntry<uint32_t> must remain compact");
 
 struct HexNumber {
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index e3b8aed63..6e66fd8a7 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -132,7 +132,8 @@ void ScalarBitSetTraits<FrameProcedureOptions>::bitset(
     IO &io, FrameProcedureOptions &Flags) {
   auto FlagNames = getFrameProcSymFlagNames();
   for (const auto &E : FlagNames) {
-    io.bitSetCase(Flags, E.getName(), static_cast<FrameProcedureOptions>(E.Value));
+    io.bitSetCase(Flags, E.getName(),
+                  static_cast<FrameProcedureOptions>(E.Value));
   }
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list