22using namespace object;
27 if (
P.Name == PartName) {
30 PartObj.
Parts.push_back({
P.Name,
P.Data});
44 "part '%s' not found", PartName.
str().c_str());
50 Obj.
Parts, [&PartName](
const Part &
P) { return P.Name == PartName; });
51 if (PartIter == Obj.
Parts.end())
53 std::make_error_code(std::errc::invalid_argument),
54 "part '%s' not found", PartName.
str().c_str());
65 if (PartName ==
"DXIL" || PartName ==
"STAT")
69 "part '%s' is empty", PartName.
str().c_str());
74 std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufferOrErr);
76 if (
Error E = Buf->commit())
83 auto [SecName, FileName] = Flag.split(
"=");
98 std::function<
bool(
const Part &)> RemovePred = [](
const Part &) {
103 RemovePred = [&Config](
const Part &
P) {
108 RemovePred = [&Config](
const Part &
P) {
129 assert(Obj &&
"Unable to deserialize DXContainer object");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< std::string > InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
static LLVM_ABI Expected< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
bool matches(StringRef S) const
Expected< std::unique_ptr< Object > > create() const
This class implements an extremely fast bulk output stream that can only output to a stream.
static Error extractPartAsObject(StringRef PartName, StringRef OutFilename, StringRef InputFilename, const Object &Obj)
static Error dumpPartToFile(StringRef PartName, StringRef Filename, StringRef InputFilename, Object &Obj)
Error executeObjcopyOnBinary(const CommonConfig &Config, const DXContainerConfig &, object::DXContainerObjectFile &In, raw_ostream &Out)
Apply the transformations described by Config and DXContainerConfig to In and writes the result into ...
static Error handleArgs(const CommonConfig &Config, Object &Obj)
This is an optimization pass for GlobalISel generic memory operations.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
LLVM_ABI Error writeToOutput(StringRef OutputFileName, std::function< Error(raw_ostream &)> Write)
This helper creates an output stream and then passes it to Write.
OutputIt copy(R &&Range, OutputIt Out)
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
SmallVector< StringRef, 0 > ExtractSection
SmallVector< StringRef, 0 > DumpSection
Error removeParts(PartPred ToRemove)
::llvm::dxbc::Header Header
SmallVector< Part > Parts