1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/include/llvm/Support/TarWriter.h
George Rimar bde67cb387 [Support/TarWriter] - Don't allow TarWriter to add the same file more than once.
This is for PR35460.

Currently when LLD adds files to TarWriter it may pass the same file
multiple times. For example it happens for clang reproduce file which specifies
archive (.a) files more than once in command line. 
Patch makes TarWriter to ignore files with the same path, so it will
add only the first one to archive.

Differential revision: https://reviews.llvm.org/D40606

llvm-svn: 319750
2017-12-05 10:09:59 +00:00

35 lines
913 B
C++

//===-- llvm/Support/TarWriter.h - Tar archive file creator -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_TAR_WRITER_H
#define LLVM_SUPPORT_TAR_WRITER_H
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
class TarWriter {
public:
static Expected<std::unique_ptr<TarWriter>> create(StringRef OutputPath,
StringRef BaseDir);
void append(StringRef Path, StringRef Data);
private:
TarWriter(int FD, StringRef BaseDir);
raw_fd_ostream OS;
std::string BaseDir;
StringSet<> Files;
};
}
#endif