summaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo/CodeView/CodeViewError.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/DebugInfo/CodeView/CodeViewError.h')
-rw-r--r--include/llvm/DebugInfo/CodeView/CodeViewError.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/include/llvm/DebugInfo/CodeView/CodeViewError.h b/include/llvm/DebugInfo/CodeView/CodeViewError.h
index 586a720ce6e40..d4615d02220df 100644
--- a/include/llvm/DebugInfo/CodeView/CodeViewError.h
+++ b/include/llvm/DebugInfo/CodeView/CodeViewError.h
@@ -24,23 +24,32 @@ enum class cv_error_code {
no_records,
unknown_member_record,
};
+} // namespace codeview
+} // namespace llvm
+
+namespace std {
+template <>
+struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
+} // namespace std
+
+namespace llvm {
+namespace codeview {
+const std::error_category &CVErrorCategory();
+
+inline std::error_code make_error_code(cv_error_code E) {
+ return std::error_code(static_cast<int>(E), CVErrorCategory());
+}
/// Base class for errors originating when parsing raw PDB files
-class CodeViewError : public ErrorInfo<CodeViewError> {
+class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
public:
+ using ErrorInfo<CodeViewError,
+ StringError>::ErrorInfo; // inherit constructors
+ CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
static char ID;
- CodeViewError(cv_error_code C);
- CodeViewError(const std::string &Context);
- CodeViewError(cv_error_code C, const std::string &Context);
+};
- void log(raw_ostream &OS) const override;
- const std::string &getErrorMessage() const;
- std::error_code convertToErrorCode() const override;
+} // namespace codeview
+} // namespace llvm
-private:
- std::string ErrMsg;
- cv_error_code Code;
-};
-}
-}
#endif