Index: lib/CodeGen/CodeGenPGO.h =================================================================== --- lib/CodeGen/CodeGenPGO.h +++ lib/CodeGen/CodeGenPGO.h @@ -40,14 +40,11 @@ std::unique_ptr ProfRecord; std::vector RegionCounts; uint64_t CurrentRegionCount; - /// \brief A flag that is set to true when this function doesn't need - /// to have coverage mapping data. - bool SkipCoverageMapping; public: CodeGenPGO(CodeGenModule &CGM) : CGM(CGM), NumValueSites({{0}}), NumRegionCounters(0), - FunctionHash(0), CurrentRegionCount(0), SkipCoverageMapping(false) {} + FunctionHash(0), CurrentRegionCount(0) {} /// Whether or not we have PGO region data for the current function. This is /// false both when we have no data at all and when our data has been Index: lib/CodeGen/CodeGenPGO.cpp =================================================================== --- lib/CodeGen/CodeGenPGO.cpp +++ lib/CodeGen/CodeGenPGO.cpp @@ -666,7 +666,7 @@ } bool CodeGenPGO::skipRegionMappingForDecl(const Decl *D) { - if (SkipCoverageMapping) + if (!D->hasBody()) return true; // Don't map the functions in system headers. Index: test/CoverageMapping/empty-destructor.cpp =================================================================== --- test/CoverageMapping/empty-destructor.cpp +++ test/CoverageMapping/empty-destructor.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -cc1 -triple i686-pc-windows-msvc19.0.0 -emit-obj -fprofile-instrument=clang -fdelayed-template-parsing -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name empty-destructor.cpp -o - %s + +struct A { + virtual ~A(); +}; + +void PR32761() { + A a; +}