[debug] Use poison instead of undef to set a killed dbg.assign address [NFC] (#119760)
[llvm-project.git] / llvm / lib / ObjCopy / XCOFF / XCOFFObjcopy.cpp
blob7db06b42adc77ecaaefdfa08ec8c840d18fa8e60
1 //===- XCOFFObjcopy.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 //===----------------------------------------------------------------------===//
9 #include "llvm/ObjCopy/XCOFF/XCOFFObjcopy.h"
10 #include "XCOFFObject.h"
11 #include "XCOFFReader.h"
12 #include "XCOFFWriter.h"
13 #include "llvm/ObjCopy/CommonConfig.h"
14 #include "llvm/ObjCopy/XCOFF/XCOFFConfig.h"
16 namespace llvm {
17 namespace objcopy {
18 namespace xcoff {
20 using namespace object;
22 static Error handleArgs(const CommonConfig &Config, Object &Obj) {
23 return Error::success();
26 Error executeObjcopyOnBinary(const CommonConfig &Config, const XCOFFConfig &,
27 XCOFFObjectFile &In, raw_ostream &Out) {
28 XCOFFReader 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 XCOFF object");
34 if (Error E = handleArgs(Config, *Obj))
35 return createFileError(Config.InputFilename, std::move(E));
36 XCOFFWriter Writer(*Obj, Out);
37 if (Error E = Writer.write())
38 return createFileError(Config.OutputFilename, std::move(E));
39 return Error::success();
42 } // end namespace xcoff
43 } // end namespace objcopy
44 } // end namespace llvm