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

Hana Dusíková via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 21:55:36 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
----------------
hanickadot wrote:

IMHO There is nothing to fix later. This will stay, it replaces former using of NullStmt in <then> branch and NULL in <else> branch.

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


More information about the cfe-commits mailing list