[clang] [clang][c++20] Fix code coverage mapping crash with generalized NTTPs (PR #85837)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 10:48:51 PDT 2024


================
@@ -2177,7 +2177,8 @@ struct CounterCoverageMappingBuilder
   }
 
   void VisitOpaqueValueExpr(const OpaqueValueExpr* OVE) {
-    Visit(OVE->getSourceExpr());
+    if (const Expr *SE = OVE->getSourceExpr())
----------------
efriedma-quic wrote:

If you have a BinaryConditionalOperator, I'm not sure this does the right thing.  If I'm following correctly, you end up visiting the condition twice, which is not accurately reflecting the way this actually executes.  The correct way to visit a BinaryConditionalOperator is to visit the "common" expression (BinaryConditionalOperator::getCommon()) first, then don't recurse into the OpaqueValueExpr.

https://github.com/llvm/llvm-project/pull/85837


More information about the cfe-commits mailing list