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

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 10 17:38:53 PST 2016


InstrProf.h has definitions of core CovMap structures so moving error
code closer to them so that InstrProf.h does not need to depend on
CoverageMapping.h.

However it seems better to do clean up the other way -- move existing
CovMap related structures to CoverageMapping.h. I will make that
change.

David

On Sun, Jan 10, 2016 at 3:42 PM, Justin Bogner <mail at justinbogner.com> wrote:
> 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