| 202 | } |
| 203 | |
| 204 | TerminationFinder::ControlFlow TerminationFinder::controlFlowKind(Statement const& _statement) |
| 205 | { |
| 206 | if ( |
| 207 | std::holds_alternative<VariableDeclaration>(_statement) && |
| 208 | std::get<VariableDeclaration>(_statement).value && |
| 209 | containsNonContinuingFunctionCall(*std::get<VariableDeclaration>(_statement).value) |
| 210 | ) |
| 211 | return ControlFlow::Terminate; |
| 212 | else if ( |
| 213 | std::holds_alternative<Assignment>(_statement) && |
| 214 | containsNonContinuingFunctionCall(*std::get<Assignment>(_statement).value) |
| 215 | ) |
| 216 | return ControlFlow::Terminate; |
| 217 | else if ( |
| 218 | std::holds_alternative<ExpressionStatement>(_statement) && |
| 219 | containsNonContinuingFunctionCall(std::get<ExpressionStatement>(_statement).expression) |
| 220 | ) |
| 221 | return ControlFlow::Terminate; |
| 222 | else if (std::holds_alternative<Break>(_statement)) |
| 223 | return ControlFlow::Break; |
| 224 | else if (std::holds_alternative<Continue>(_statement)) |
| 225 | return ControlFlow::Continue; |
| 226 | else if (std::holds_alternative<Leave>(_statement)) |
| 227 | return ControlFlow::Leave; |
| 228 | else |
| 229 | return ControlFlow::FlowOut; |
| 230 | } |
| 231 | |
| 232 | bool TerminationFinder::containsNonContinuingFunctionCall(Expression const& _expr) |
| 233 | { |
no outgoing calls
no test coverage detected