- : Term(T), idx(Term->getNumSuccessors()) {
- assert(T && "getTerminator returned null!");
- }
-
- inline const _Self &operator=(const _Self &I) {
+ : Term(T) {
+ if (Term)
+ idx = Term->getNumSuccessors();
+ else
+ // Term == NULL happens, if a basic block is not fully constructed and
+ // consequently getTerminator() returns NULL. In this case we construct a
+ // SuccIterator which describes a basic block that has zero successors.
+ // Defining SuccIterator for incomplete and malformed CFGs is especially
+ // useful for debugging.
+ idx = 0;
+ }
+
+ inline const Self &operator=(const Self &I) {