Skip to content

TableGen: Avoid emitting trailing whitespace in StringToOffsetTable #148840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jul 15, 2025

No description provided.

Copy link
Contributor Author

arsenm commented Jul 15, 2025

@arsenm arsenm requested review from jurahul and nikic July 15, 2025 12:28
@arsenm arsenm added the tablegen label Jul 15, 2025 — with Graphite App
@arsenm arsenm marked this pull request as ready for review July 15, 2025 12:28
@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2025

@llvm/pr-subscribers-tablegen

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/148840.diff

1 Files Affected:

  • (modified) llvm/lib/TableGen/StringToOffsetTable.cpp (+1-1)
diff --git a/llvm/lib/TableGen/StringToOffsetTable.cpp b/llvm/lib/TableGen/StringToOffsetTable.cpp
index 9fb41485db745..d6d2c2590389a 100644
--- a/llvm/lib/TableGen/StringToOffsetTable.cpp
+++ b/llvm/lib/TableGen/StringToOffsetTable.cpp
@@ -38,7 +38,7 @@ void StringToOffsetTable::EmitStringTableDef(raw_ostream &OS,
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Woverlength-strings"
 #endif
-{} constexpr char {}{}Storage[] = )",
+{} constexpr char {}{}Storage[] =)",
                 ClassPrefix.empty() ? "static" : "", ClassPrefix, Name);
 
   // MSVC silently miscompiles string literals longer than 64k in some

@@ -38,7 +38,7 @@ void StringToOffsetTable::EmitStringTableDef(raw_ostream &OS,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
{} constexpr char {}{}Storage[] = )",
{} constexpr char {}{}Storage[] =)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'd want to add a whitespace before "{\n" a few lines below then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, it looks right as is. Every entry ends up on its own line, though under-indented

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm referring to the >64k case, which now would print ={ instead of = { I think. But it doesn't particularly matter...

@@ -38,7 +38,7 @@ void StringToOffsetTable::EmitStringTableDef(raw_ostream &OS,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
{} constexpr char {}{}Storage[] = )",
{} constexpr char {}{}Storage[] =)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm referring to the >64k case, which now would print ={ instead of = { I think. But it doesn't particularly matter...

Copy link
Contributor Author

arsenm commented Jul 15, 2025

Merge activity

  • Jul 15, 2:13 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 15, 2:25 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 15, 2:27 PM UTC: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/tablegen/use-string-offset-table-runtime-libcall-names branch 3 times, most recently from 0798c63 to b113ff2 Compare July 15, 2025 14:21
Base automatically changed from users/arsenm/tablegen/use-string-offset-table-runtime-libcall-names to main July 15, 2025 14:24
@arsenm arsenm force-pushed the users/arsenm/tablegen/avoid-trailing-whitespace-string-to-offset-table branch from 8e3742e to 74ed3cc Compare July 15, 2025 14:25
@arsenm arsenm merged commit 8db92a7 into main Jul 15, 2025
7 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/tablegen/avoid-trailing-whitespace-string-to-offset-table branch July 15, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants