[PATCH] D124041: [ELF] Move SymbolUnion size assertion to source file

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 13:51:36 PDT 2022


smeenai created this revision.
smeenai added reviewers: MaskRay, peter.smith, ikudrin.
Herald added subscribers: StephenFan, arichardson, emaste.
Herald added a project: All.
smeenai requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Otherwise it fires for every single file which includes the header,
which is very noisy when building.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124041

Files:
  lld/ELF/Symbols.cpp
  lld/ELF/Symbols.h


Index: lld/ELF/Symbols.h
===================================================================
--- lld/ELF/Symbols.h
+++ lld/ELF/Symbols.h
@@ -483,11 +483,6 @@
   alignas(LazyObject) char e[sizeof(LazyObject)];
 };
 
-// It is important to keep the size of SymbolUnion small for performance and
-// memory usage reasons. 64 bytes is a soft limit based on the size of Defined
-// on a 64-bit system.
-static_assert(sizeof(SymbolUnion) <= 64, "SymbolUnion too large");
-
 template <typename T> struct AssertSymbol {
   static_assert(std::is_trivially_destructible<T>(),
                 "Symbol types must be trivially destructible");
Index: lld/ELF/Symbols.cpp
===================================================================
--- lld/ELF/Symbols.cpp
+++ lld/ELF/Symbols.cpp
@@ -24,6 +24,11 @@
 using namespace lld;
 using namespace lld::elf;
 
+// It is important to keep the size of SymbolUnion small for performance and
+// memory usage reasons. 64 bytes is a soft limit based on the size of Defined
+// on a 64-bit system.
+static_assert(sizeof(SymbolUnion) <= 64, "SymbolUnion too large");
+
 std::string lld::toString(const elf::Symbol &sym) {
   StringRef name = sym.getName();
   std::string ret = demangle(name, config->demangle);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124041.423729.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/7d5ff897/attachment-0001.bin>


More information about the llvm-commits mailing list