[clang] [clang][coverage] fixing "if constexpr" and "if consteval" coverage report (PR #77214)

Jessica Paquette via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 20:02:12 PST 2024


================
@@ -7732,7 +7732,11 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
     if (Then.isInvalid())
       return StmtError();
   } else {
-    Then = new (getSema().Context) NullStmt(S->getThen()->getBeginLoc());
+    // Discarded branch is replaced with empty CompoundStmt so we can keep
+    // proper source location for start and end of original branch, so
+    // subsequent transformations like CoverageMapping work properly
----------------
ornata wrote:

In the test, you mention that we're generating coverage for the discarded regions. Is the reason that we're generating a `CompoundStmt` here? Could this use a `FIXME`?

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


More information about the cfe-commits mailing list