|
| 1 | +//===- DXContainerObjcopy.cpp ---------------------------------------------===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +#include "llvm/ObjCopy/DXContainer/DXContainerObjcopy.h" |
| 10 | +#include "DXContainerReader.h" |
| 11 | +#include "DXContainerWriter.h" |
| 12 | +#include "llvm/ObjCopy/CommonConfig.h" |
| 13 | +#include "llvm/ObjCopy/DXContainer/DXContainerConfig.h" |
| 14 | + |
| 15 | +namespace llvm { |
| 16 | +namespace objcopy { |
| 17 | +namespace dxbc { |
| 18 | + |
| 19 | +using namespace object; |
| 20 | + |
| 21 | +static Error handleArgs(const CommonConfig &Config, Object &Obj) { |
| 22 | + return Error::success(); |
| 23 | +} |
| 24 | + |
| 25 | +Error executeObjcopyOnBinary(const CommonConfig &Config, |
| 26 | + const DXContainerConfig &, |
| 27 | + DXContainerObjectFile &In, raw_ostream &Out) { |
| 28 | + DXContainerReader Reader(In); |
| 29 | + Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create(); |
| 30 | + if (!ObjOrErr) |
| 31 | + return createFileError(Config.InputFilename, ObjOrErr.takeError()); |
| 32 | + Object *Obj = ObjOrErr->get(); |
| 33 | + assert(Obj && "Unable to deserialize DXContainer object"); |
| 34 | + |
| 35 | + if (Error E = handleArgs(Config, *Obj)) |
| 36 | + return E; |
| 37 | + |
| 38 | + DXContainerWriter Writer(*Obj, Out); |
| 39 | + if (Error E = Writer.write()) |
| 40 | + return createFileError(Config.OutputFilename, std::move(E)); |
| 41 | + return Error::success(); |
| 42 | +} |
| 43 | + |
| 44 | +} // end namespace dxbc |
| 45 | +} // end namespace objcopy |
| 46 | +} // end namespace llvm |
0 commit comments