1 //===- llvm-objcopy.h -------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_OBJCOPY_OBJCOPY_H
10 #define LLVM_TOOLS_OBJCOPY_OBJCOPY_H
12 #include "llvm/ADT/Twine.h"
13 #include "llvm/Support/Compiler.h"
14 #include "llvm/Support/Error.h"
15 #include "llvm/Support/raw_ostream.h"
21 LLVM_ATTRIBUTE_NORETURN
extern void error(Twine Message
);
22 LLVM_ATTRIBUTE_NORETURN
extern void error(Error E
);
23 LLVM_ATTRIBUTE_NORETURN
extern void reportError(StringRef File
, Error E
);
24 LLVM_ATTRIBUTE_NORETURN
extern void reportError(StringRef File
,
27 // This is taken from llvm-readobj.
28 // [see here](llvm/tools/llvm-readobj/llvm-readobj.h:38)
29 template <class T
> T
unwrapOrError(Expected
<T
> EO
) {
33 raw_string_ostream
OS(Buf
);
34 logAllUnhandledErrors(EO
.takeError(), OS
);
39 } // end namespace objcopy
40 } // end namespace llvm
42 #endif // LLVM_TOOLS_OBJCOPY_OBJCOPY_H