[llvm] r257295 - Move coveragemap_error enum into coverage namespace and InstrProf.h /NFC

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 10 15:42:25 PST 2016


Xinliang David Li via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: davidxl
> Date: Sun Jan 10 15:56:33 2016
> New Revision: 257295
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257295&view=rev
> Log:
> Move coveragemap_error enum into coverage namespace and InstrProf.h /NFC

Putting this in the coverage namespace makes sense, but why would it be
in InstrProf.h? CoverageMapping.h is a natural fit.

> Modified:
>     llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
>     llvm/trunk/include/llvm/ProfileData/InstrProf.h
>     llvm/trunk/lib/ProfileData/CoverageMapping.cpp
>
> Modified: llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMapping.h?rev=257295&r1=257294&r2=257295&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ProfileData/CoverageMapping.h (original)
> +++ llvm/trunk/include/llvm/ProfileData/CoverageMapping.h Sun Jan 10 15:56:33 2016
> @@ -482,26 +482,6 @@ template<> struct DenseMapInfo<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());
> -}
> -
>  } // end namespace llvm
>  
> -namespace std {
> -template <>
> -struct is_error_code_enum<llvm::coveragemap_error> : std::true_type {};
> -}
> -
>  #endif // LLVM_PROFILEDATA_COVERAGEMAPPING_H_
>
> Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=257295&r1=257294&r2=257295&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
> +++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Sun Jan 10 15:56:33 2016
> @@ -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_
>
> Modified: llvm/trunk/lib/ProfileData/CoverageMapping.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMapping.cpp?rev=257295&r1=257294&r2=257295&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ProfileData/CoverageMapping.cpp (original)
> +++ llvm/trunk/lib/ProfileData/CoverageMapping.cpp Sun Jan 10 15:56:33 2016
> @@ -517,6 +517,6 @@ class CoverageMappingErrorCategoryType :
>  
>  static ManagedStatic<CoverageMappingErrorCategoryType> ErrorCategory;
>  
> -const std::error_category &llvm::coveragemap_category() {
> +const std::error_category &llvm::coverage::coveragemap_category() {
>    return *ErrorCategory;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list