aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-04-14 21:41:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-07-23 17:38:08 +0000
commit320d4fb58b6b1c6a0c7ffeab3d4672d1479d5e17 (patch)
tree4b5e279a6f091bb6bdc639752cf4139dfd7053a4 /contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp
parent814cfa6ad43c73de9b8030f241f516dad3f669ef (diff)
downloadsrc-320d4fb58b6b1c6a0c7ffeab3d4672d1479d5e17.tar.gz
src-320d4fb58b6b1c6a0c7ffeab3d4672d1479d5e17.zip
Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-16-init-18548-gb0daacf58f41. PR: 271047 MFC after: 1 month (cherry picked from commit bdd1243df58e60e85101c09001d9812a789b6bc4)
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp')
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp b/contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp
index 1c7484ba5496..32dbf3d489c0 100644
--- a/contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-size/llvm-size.cpp
@@ -47,11 +47,14 @@ enum ID {
#undef OPTION
};
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#define PREFIX(NAME, VALUE) \
+ static constexpr StringLiteral NAME##_init[] = VALUE; \
+ static constexpr ArrayRef<StringLiteral> NAME(NAME##_init, \
+ std::size(NAME##_init) - 1);
#include "Opts.inc"
#undef PREFIX
-const opt::OptTable::Info InfoTable[] = {
+static constexpr opt::OptTable::Info InfoTable[] = {
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES) \
{ \
@@ -63,9 +66,9 @@ const opt::OptTable::Info InfoTable[] = {
#undef OPTION
};
-class SizeOptTable : public opt::OptTable {
+class SizeOptTable : public opt::GenericOptTable {
public:
- SizeOptTable() : OptTable(InfoTable) { setGroupedShortOptions(true); }
+ SizeOptTable() : GenericOptTable(InfoTable) { setGroupedShortOptions(true); }
};
enum OutputFormatTy { berkeley, sysv, darwin };
@@ -570,6 +573,8 @@ static void printFileSectionSizes(StringRef file) {
else if (MachO && OutputFormat == darwin)
outs() << a->getFileName() << "(" << o->getFileName() << "):\n";
printObjectSectionSizes(o);
+ if (!MachO && OutputFormat == darwin)
+ outs() << o->getFileName() << " (ex " << a->getFileName() << ")\n";
if (OutputFormat == berkeley) {
if (MachO)
outs() << a->getFileName() << "(" << o->getFileName() << ")\n";
@@ -836,6 +841,8 @@ static void printFileSectionSizes(StringRef file) {
else if (MachO && OutputFormat == darwin && MoreThanOneFile)
outs() << o->getFileName() << ":\n";
printObjectSectionSizes(o);
+ if (!MachO && OutputFormat == darwin)
+ outs() << o->getFileName() << "\n";
if (OutputFormat == berkeley) {
if (!MachO || MoreThanOneFile)
outs() << o->getFileName();
@@ -862,7 +869,7 @@ static void printBerkeleyTotals() {
<< "(TOTALS)\n";
}
-int main(int argc, char **argv) {
+int llvm_size_main(int argc, char **argv) {
InitLLVM X(argc, argv);
BumpPtrAllocator A;
StringSaver Saver(A);
@@ -937,4 +944,5 @@ int main(int argc, char **argv) {
if (HadError)
return 1;
+ return 0;
}