Skip to content

Commit 3d782a2

Browse files
committed
Short circuit default initialization of array elements
Implement remaining TODO from bug 543038 where we already checked default init of array element and worst cost will no longer change.
1 parent fd06dca commit 3d782a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AggregateInitialization.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ private Cost checkInitializationOfElements(IType type, Cost worstCost) throws DO
167167
if (cost.compareTo(worstCost) > 0) {
168168
worstCost = cost;
169169
}
170+
171+
if (fIndex > fInitializers.length) {
172+
// Already checked default-initialization, short-circuit now
173+
// as worst cost will no longer change
174+
break;
175+
}
170176
}
171177
}
172178
}

0 commit comments

Comments
 (0)