From 18fb1665bfcb033f01d69836abf99f393866a53c Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 15 Nov 2010 22:59:22 +0000 Subject: Remove invalid assertion from CFG builder. When building the CFG pieces for a ternary '?' expression, it is possible for the confluence block to only have a single predecessor due to calls to 'noreturn' functions. Fixes assertion failure reported in PR 8619. llvm-svn: 119284 --- clang/lib/Analysis/CFG.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Analysis/CFG.cpp') diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index ef67d3b9576..b58e9826d33 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1204,7 +1204,8 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(ConditionalOperator *C, // want the first predecessor to the the block containing the expression // for the case when the ternary expression evaluates to true. AddSuccessor(Block, ConfluenceBlock); - assert(ConfluenceBlock->pred_size() == 2); + // Note that there can possibly only be one predecessor if one of the + // subexpressions resulted in calling a noreturn function. std::reverse(ConfluenceBlock->pred_begin(), ConfluenceBlock->pred_end()); } -- cgit v1.2.3