[PATCH] D64668: [llvm-lipo] Implement -info

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 04:35:38 PDT 2019


alexshap added inline comments.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:270
 
-LLVM_ATTRIBUTE_NORETURN
-static void printArchs(ArrayRef<OwningBinary<Binary>> InputBinaries) {
+static void printBinaryArchs(const Binary *Binary, raw_ostream &OutputStream) {
   // Prints trailing space for compatibility with cctools lipo.
----------------
compnerd wrote:
> `OS` is the naming convention for the output stream
+1


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:301
+static void printInfo(ArrayRef<OwningBinary<Binary>> InputBinaries) {
+  std::string UniversalOutputBuffer;
+  raw_string_ostream UniversalOutputStream(UniversalOutputBuffer);
----------------
khm, the same effect (grouping universal/regular files) could be achieved a bit simpler, what would you say to the following (no need for std::string, raw_string_ostream, ThinOutputBuffer, ThinOutputStream, UniversalOutputBuffer, UniversalOutputStream, etc)
     
    for (const auto &IB : InputBinaries)
        if (IB.getBinary()->isMachOUniversalBinary()) {
             outs() << "Architectures in the fat file: " << Binary->getFileName() 
                       << " are: ";
             printBinaryArchs(IB.getBinary(), outs());
        }
     for (const auto &IB : InputBinaries)
        if (IB.getBinary()->isMachO) {
             outs() << "Non-fat file: " << IB.getBinary()->getFileName()
                       << " is architecture: ";
             printBinaryArchs(IB.getBinary(), outs());
        }            


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64668





More information about the llvm-commits mailing list