[clang] 816144b - [Coverage] Skip visiting ctor member initializers with invalid source locations.

Zequan Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 11:59:51 PDT 2023


Author: Zequan Wu
Date: 2023-09-19T14:59:41-04:00
New Revision: 816144bfd2d86701020c0c7b693d403f8fc8dffe

URL: https://github.com/llvm/llvm-project/commit/816144bfd2d86701020c0c7b693d403f8fc8dffe
DIFF: https://github.com/llvm/llvm-project/commit/816144bfd2d86701020c0c7b693d403f8fc8dffe.diff

LOG: [Coverage] Skip visiting ctor member initializers with invalid source locations.

Added: 
    

Modified: 
    clang/lib/CodeGen/CoverageMappingGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index bb814dfbfd580f1..32c67739915380c 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1044,7 +1044,8 @@ struct CounterCoverageMappingBuilder
       for (auto *Initializer : Ctor->inits()) {
         if (Initializer->isWritten()) {
           auto *Init = Initializer->getInit();
-          propagateCounts(BodyCounter, Init);
+          if (getStart(Init).isValid() && getEnd(Init).isValid())
+            propagateCounts(BodyCounter, Init);
         }
       }
     }


        


More information about the cfe-commits mailing list