Use ErrorOr for the ::create factory on instrumented and sample profilers.
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
index 8457678c4ec6d4c5440898b4aefe2fd33c241392..eafb76886c83e8ff4697846e388213dedf9aa7cc 100644 (file)
 #ifndef LLVM_PROFILEDATA_INSTRPROF_H_
 #define LLVM_PROFILEDATA_INSTRPROF_H_
 
-#include "llvm/Support/system_error.h"
+#include <system_error>
 
 namespace llvm {
+const std::error_category &instrprof_category();
 
-const error_category &instrprof_category();
-
-struct instrprof_error {
-  enum ErrorType {
+enum class instrprof_error {
     success = 0,
     eof,
     bad_magic,
@@ -37,21 +35,17 @@ struct instrprof_error {
     hash_mismatch,
     count_mismatch,
     counter_overflow
-  };
-  ErrorType V;
-
-  instrprof_error(ErrorType V) : V(V) {}
-  operator ErrorType() const { return V; }
 };
 
-inline error_code make_error_code(instrprof_error E) {
-  return error_code(static_cast<int>(E), instrprof_category());
+inline std::error_code make_error_code(instrprof_error E) {
+  return std::error_code(static_cast<int>(E), instrprof_category());
 }
 
-template <> struct is_error_code_enum<instrprof_error> : std::true_type {};
-template <> struct is_error_code_enum<instrprof_error::ErrorType>
-  : std::true_type {};
-
 } // end namespace llvm
 
+namespace std {
+template <>
+struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
+}
+
 #endif // LLVM_PROFILEDATA_INSTRPROF_H_