[PATCH] D11787: Port the error functions from ELF to COFF.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 07:44:59 PDT 2015


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: COFF/Error.cpp:28
@@ +27,3 @@
+}
+}
+}
----------------
Add a blank line.

================
Comment at: COFF/Error.h:18-20
@@ -19,30 +17,5 @@
 
-enum class LLDError {
-  InvalidOption = 1,
-  InvalidFile,
-  BrokenFile,
-  DuplicateSymbols,
-};
-
-class LLDErrorCategory : public std::error_category {
-public:
-  const char *name() const LLVM_NOEXCEPT override { return "lld"; }
-
-  std::string message(int EV) const override {
-    switch (static_cast<LLDError>(EV)) {
-    case LLDError::InvalidOption:
-      return "Invalid option";
-    case LLDError::InvalidFile:
-      return "Invalid file";
-    case LLDError::BrokenFile:
-      return "Broken file";
-    case LLDError::DuplicateSymbols:
-      return "Duplicate symbols";
-    }
-    llvm_unreachable("unknown error");
-  }
-};
-
-inline std::error_code make_error_code(LLDError Err) {
-  static LLDErrorCategory C;
-  return std::error_code(static_cast<int>(Err), C);
+LLVM_ATTRIBUTE_NORETURN void error(const Twine &Msg);
+void error(std::error_code EC, const Twine &Prefix);
+template <typename T> void error(const ErrorOr<T> &V, const Twine &Prefix) {
+  error(V.getError(), Prefix);
----------------
Add blank lines between definitions/declarations.


Repository:
  rL LLVM

http://reviews.llvm.org/D11787





More information about the llvm-commits mailing list