File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ struct CoverageMapping : public ASTWalker {
290
290
291
291
// / \brief Create a counter expression for \c Node and add it to the map.
292
292
CounterExpr &assignCounter (ASTNode Node, CounterExpr &&Expr) {
293
+ assert (Node && " Assigning counter expression to non-existent AST node" );
293
294
CounterExpr &Result = createCounter (std::move (Expr));
294
295
CounterMap[Node] = &Result;
295
296
return Result;
@@ -491,8 +492,9 @@ struct CoverageMapping : public ASTWalker {
491
492
} else if (auto *IS = dyn_cast<IfStmt>(S)) {
492
493
assignCounter (IS, CounterExpr::Zero ());
493
494
CounterExpr &ThenCounter = assignCounter (IS->getThenStmt ());
494
- assignCounter (IS->getElseStmt (),
495
- CounterExpr::Sub (getCurrentCounter (), ThenCounter));
495
+ if (IS->getElseStmt ())
496
+ assignCounter (IS->getElseStmt (),
497
+ CounterExpr::Sub (getCurrentCounter (), ThenCounter));
496
498
} else if (auto *GS = dyn_cast<GuardStmt>(S)) {
497
499
assignCounter (GS, CounterExpr::Zero ());
498
500
assignCounter (GS->getBody ());
You can’t perform that action at this time.
0 commit comments