[PATCH] D111541: [Object] Deduplicate the three createError functions
Raphael Isemann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 07:21:29 PDT 2021
teemperor updated this revision to Diff 378659.
teemperor added a comment.
- Remove static
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111541/new/
https://reviews.llvm.org/D111541
Files:
llvm/include/llvm/Object/ELF.h
llvm/include/llvm/Object/Error.h
llvm/lib/Object/COFFModuleDefinition.cpp
llvm/lib/Object/XCOFFObjectFile.cpp
Index: llvm/lib/Object/XCOFFObjectFile.cpp
===================================================================
--- llvm/lib/Object/XCOFFObjectFile.cpp
+++ llvm/lib/Object/XCOFFObjectFile.cpp
@@ -43,10 +43,6 @@
Offset);
}
-static Error createError(const Twine &Err) {
- return make_error<StringError>(Err, object_error::parse_failed);
-}
-
template <typename T> static const T *viewAs(uintptr_t in) {
return reinterpret_cast<const T *>(in);
}
Index: llvm/lib/Object/COFFModuleDefinition.cpp
===================================================================
--- llvm/lib/Object/COFFModuleDefinition.cpp
+++ llvm/lib/Object/COFFModuleDefinition.cpp
@@ -80,11 +80,6 @@
(!MingwDef && Sym.contains('@'));
}
-static Error createError(const Twine &Err) {
- return make_error<StringError>(StringRef(Err.str()),
- object_error::parse_failed);
-}
-
class Lexer {
public:
Lexer(StringRef S) : Buf(S) {}
Index: llvm/include/llvm/Object/Error.h
===================================================================
--- llvm/include/llvm/Object/Error.h
+++ llvm/include/llvm/Object/Error.h
@@ -82,6 +82,10 @@
/// error() function needs to called on the llvm::Error.
Error isNotObjectErrorInvalidFileType(llvm::Error Err);
+inline Error createError(const Twine &Err) {
+ return make_error<StringError>(Err, object_error::parse_failed);
+}
+
} // end namespace object.
} // end namespace llvm.
Index: llvm/include/llvm/Object/ELF.h
===================================================================
--- llvm/include/llvm/Object/ELF.h
+++ llvm/include/llvm/Object/ELF.h
@@ -81,10 +81,6 @@
(uint8_t)Object[ELF::EI_DATA]);
}
-static inline Error createError(const Twine &Err) {
- return make_error<StringError>(Err, object_error::parse_failed);
-}
-
enum PPCInstrMasks : uint64_t {
PADDI_R12_NO_DISP = 0x0610000039800000,
ADDIS_R12_TO_R2_NO_DISP = 0x3D820000,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111541.378659.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/6cefbc9c/attachment.bin>
More information about the llvm-commits
mailing list