Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f333426f54aa68c3a29245a7b8722df67c46ba3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*******************************************************************************
 * Copyright (c) 2009, 2010 Alena Laskavaia 
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Alena Laskavaia  - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.codan.core.model.cfg;

import java.util.Collection;
import java.util.Iterator;

/**
 * Represents control flow graph (CFG) object.
 * This is "normalized" control flow graph, with typed nodes:
 * <br>
 * <li> {@link IStartNode} - start node of the cfg (source)
 * <li> {@link IExitNode} - exit node of the cfg (sink)
 * <li> {@link IPlainNode} - has one incoming one outgoing
 * <li> {@link IDecisionNode} - has one incoming and the only node that can have
 * multiple outcoming
 * arcs
 * <li> {@link IConnectorNode} - the only node that can have multiple incoming
 * arcs, and one outgoing
 * <li> {@link IJumpNode} - has one incoming and one outgoing but represent
 * change of control direction
 * <li> {@link IBranchNode} - usually node where decision node connect to,
 * labels represent a way where controls goes to
 * 
 * @noextend This interface is not intended to be extended by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IControlFlowGraph {
	/**
	 * @return start node of the graph. CFG only has one start node.
	 */
	IStartNode getStartNode();

	/**
	 * @return iterator over exit nodes of control flow graph. Exit nodes
	 *         include return statement,
	 *         and statements with throw and abort/exit functions.
	 */
	Iterator<IExitNode> getExitNodeIterator();

	/**
	 * @return size of exit nodes list
	 */
	int getExitNodeSize();

	/**
	 * @return list of roots of dead code sections, they don't have incoming
	 *         arcs
	 */
	Iterator<IBasicBlock> getUnconnectedNodeIterator();

	/**
	 * @return size of unconnected nodes list
	 */
	int getUnconnectedNodeSize();

	/**
	 * @return collection of all nodes
	 */
	Collection<IBasicBlock> getNodes();
}

Back to the top