[PATCH] D118867: [llvm-libtool-darwin] Improve warning message for no symbols

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 17:41:45 PST 2022


keith updated this revision to Diff 405506.
keith added a comment.

Update formatting


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118867/new/

https://reviews.llvm.org/D118867

Files:
  llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
  llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp


Index: llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
===================================================================
--- llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
+++ llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
@@ -361,8 +361,9 @@
 
       auto *O = dyn_cast<MachOObjectFile>(ObjOrErr->get());
       uint32_t FileCPUType, FileCPUSubtype;
+      StringRef ArchName = O->getArchTriple().getArchName();
       std::tie(FileCPUType, FileCPUSubtype) = MachO::getCPUTypeFromArchitecture(
-          MachO::getArchitectureFromName(O->getArchTriple().getArchName()));
+          MachO::getArchitectureFromName(ArchName));
 
       // If -arch_only is specified then skip this file if it doesn't match
       // the architecture specified.
@@ -371,7 +372,9 @@
       }
 
       if (!NoWarningForNoSymbols && O->symbols().empty())
-        WithColor::warning() << Member.MemberName + " has no symbols\n";
+        WithColor::warning() << "'" + Member.MemberName +
+                                    "': no symbols for architecture " +
+                                    ArchName + "\n";
 
       uint64_t FileCPUID = getCPUID(FileCPUType, FileCPUSubtype);
       Builder.Data.MembersPerArchitecture[FileCPUID].push_back(
Index: llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
===================================================================
--- llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
+++ llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
@@ -9,7 +9,7 @@
 # RUN: llvm-libtool-darwin -static -o %t.lib %t-x86_64-empty.o 2>&1 | \
 # RUN:   FileCheck --check-prefix=WARNING %s -DPREFIX=%basename_t.tmp
 
-# WARNING: warning: [[PREFIX]]-x86_64-empty.o has no symbols
+# WARNING: warning: '[[PREFIX]]-x86_64-empty.o': has no symbols for architecture x86_64
 
 # RUN: llvm-libtool-darwin -no_warning_for_no_symbols -static -o %t.lib \
 # RUN:   %t-x86_64-empty.o 2>&1 | \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118867.405506.patch
Type: text/x-patch
Size: 1943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220203/8fa7b48c/attachment.bin>


More information about the llvm-commits mailing list