[PATCH] D100651: [AIX] Support of Big archive (read)

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 15:05:10 PDT 2021


DiggerLin added inline comments.


================
Comment at: llvm/lib/Object/Archive.cpp:308-320
     std::string Buf;
     raw_string_ostream OS(Buf);
     OS.write_escaped(
-        StringRef(ArMemHdr->AccessMode, sizeof(ArMemHdr->AccessMode))
-            .rtrim(" "));
+        StringRef(ArMemHdr->Size, sizeof(ArMemHdr->Size)).rtrim(" "));
     OS.flush();
     uint64_t Offset =
         reinterpret_cast<const char *>(ArMemHdr) - Parent->getData().data();
----------------
DiggerLin wrote:
> there are several place use the almost the same code from line 308 to 320 . can we change these lines into a helper function?
and I just wonder why you need the code 

```
std::string Buf;
    raw_string_ostream OS(Buf);
    OS.write_escaped(
        StringRef(ArMemHdr->Size, sizeof(ArMemHdr->Size)).rtrim(" "));
    OS.flush();
```
to convert to std::string.

for the StringRef , there is a function str() to convert to std::string, why not use str() of StringRef ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100651



More information about the llvm-commits mailing list