adamf updated this revision to Diff 96454.
adamf added a comment.

Thanks for your comments!

Updated test case according to @vsk comment about test case reduction.

@rnk, your compilation command probably exposes another issue (with your 
compilation command the test still failure). I don't have time to analyze it 
now.

I don't have write access to svn so if you think this change is ok please 
commit it.


https://reviews.llvm.org/D32406

Files:
  lib/CodeGen/CodeGenPGO.cpp
  lib/CodeGen/CodeGenPGO.h
  test/CoverageMapping/empty-destructor.cpp


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;
+}
Index: lib/CodeGen/CodeGenPGO.h
===================================================================
--- lib/CodeGen/CodeGenPGO.h
+++ lib/CodeGen/CodeGenPGO.h
@@ -40,14 +40,11 @@
   std::unique_ptr<llvm::InstrProfRecord> ProfRecord;
   std::vector<uint64_t> 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;
+}
Index: lib/CodeGen/CodeGenPGO.h
===================================================================
--- lib/CodeGen/CodeGenPGO.h
+++ lib/CodeGen/CodeGenPGO.h
@@ -40,14 +40,11 @@
   std::unique_ptr<llvm::InstrProfRecord> ProfRecord;
   std::vector<uint64_t> 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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to