Go to the documentation of this file.
71 int Len =
Key.size() + Val.
size() + 3;
95 for (
size_t I = 0;
I <
sizeof(Hdr); ++
I)
96 Chksum +=
reinterpret_cast<uint8_t *
>(&Hdr)[
I];
104 std::string PaxAttr =
formatPax(
"path", Path);
108 snprintf(Hdr.
Size,
sizeof(Hdr.
Size),
"%011zo", PaxAttr.size());
113 OS << StringRef(reinterpret_cast<char *>(&Hdr),
sizeof(Hdr));
143 const int MaxPrefix = 137;
144 size_t Sep = Path.rfind(
'/', MaxPrefix + 1);
150 Prefix = Path.substr(0, Sep);
151 Name = Path.substr(Sep + 1);
162 snprintf(Hdr.
Size,
sizeof(Hdr.
Size),
"%011zo", Size);
165 OS << StringRef(reinterpret_cast<char *>(&Hdr),
sizeof(Hdr));
171 using namespace sys::fs;
173 if (std::error_code EC =
175 return make_error<StringError>(
"cannot open " + OutputPath, EC);
176 return std::unique_ptr<TarWriter>(
new TarWriter(FD, BaseDir));
179 TarWriter::TarWriter(
int FD,
StringRef BaseDir)
189 if (!Files.
insert(Fullpath).second)
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
uint64_t tell() const
tell - Return the current offset with the file.
static std::string formatPax(StringRef Key, StringRef Val)
void append(StringRef Path, StringRef Data)
std::error_code openFileForWrite(const Twine &Name, int &ResultFD, CreationDisposition Disp=CD_CreateAlways, OpenFlags Flags=OF_None, unsigned Mode=0666)
Opens the file with the given name in a write-only or read-write mode, returning its open file descri...
This is an optimization pass for GlobalISel generic memory operations.
static const int BlockSize
static UstarHeader makeUstarHeader()
static bool splitUstar(StringRef Path, StringRef &Prefix, StringRef &Name)
static constexpr size_t npos
std::string convert_to_slash(StringRef path, Style style=Style::native)
Replaces backslashes with slashes if Windows.
std::pair< typename Base::iterator, bool > insert(StringRef key)
Tagged union holding either a T or a Error.
uint64_t seek(uint64_t off)
Flushes the stream and repositions the underlying file descriptor position to the offset specified fr...
std::string str() const
Return the twine contents as a std::string.
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
@ CD_CreateAlways
CD_CreateAlways - When opening a file:
static void writeUstarHeader(raw_fd_ostream &OS, StringRef Prefix, StringRef Name, size_t Size)
StringRef - Represent a constant reference to a string, i.e.
static const char Magic[]
static void computeChecksum(UstarHeader &Hdr)
A raw_ostream that writes to a file descriptor.
constexpr size_t size() const
size - Get the string size.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static void writePaxHeader(raw_fd_ostream &OS, StringRef Path)
static void pad(raw_fd_ostream &OS)
static Expected< std::unique_ptr< TarWriter > > create(StringRef OutputPath, StringRef BaseDir)