Move coveragemap_error enum into coverage namespace and InstrProf.h /NFC
[oota-llvm.git] / include / llvm / ProfileData / InstrProf.h
index 299763429006566cf2c651c4ae121146fa915a2c..b78f8041a6b96098255b74de7bb02ac73edbac12 100644 (file)
@@ -634,6 +634,22 @@ struct Header {
 
 namespace coverage {
 
+const std::error_category &coveragemap_category();
+
+enum class coveragemap_error {
+  success = 0,
+  eof,
+  no_data_found,
+  unsupported_version,
+  truncated,
+  malformed
+};
+
+inline std::error_code make_error_code(coveragemap_error E) {
+  return std::error_code(static_cast<int>(E), coveragemap_category());
+}
+
+
 // Profile coverage map has the following layout:
 // [CoverageMapFileHeader]
 // [ArrayStart]
@@ -668,6 +684,8 @@ enum CoverageMappingVersion {
 namespace std {
 template <>
 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
+template <>
+struct is_error_code_enum<llvm::coverage::coveragemap_error> : std::true_type {};
 }
 
 #endif // LLVM_PROFILEDATA_INSTRPROF_H_