Use inline constexpr where appropriate. (#6374)

This fixes various violations of C++'s One Definition Rule, where we
accidentally gave the same static data member multiple definitions in
different translation units. Clang happens to emit such definitions with
weak linkage, which allows us to get away with this without link errors,
but it's still formally incorrect.

Also switch keyword order around for a handful of instances of
`constexpr inline`, per agreement in open discussion.

This happens to reduce the size of a `-c dbg` toolchain binary by 7.2
MiB, presumably by making more of our symbols and especially debug info
discardable.
This commit is contained in:
Richard Smith
2025-11-14 13:50:56 +00:00
committed by GitHub
parent 2b8fdf3417
commit b300f36e6f
18 changed files with 96 additions and 83 deletions
+1 -1
View File
@@ -637,7 +637,7 @@ class NodeStack {
llvm::SmallVector<Entry> stack_;
};
constexpr NodeStack::IdKindTableType NodeStack::IdKindTable =
inline constexpr NodeStack::IdKindTableType NodeStack::IdKindTable =
ComputeIdKindTable();
inline auto NodeStack::PopExprWithNodeId()