[clang-format] Hoist vector allocation out of loop. NFC.

llvm-svn: 239604
This commit is contained in:
Benjamin Kramer 2015-06-12 13:06:57 +00:00
parent 0b9319edb0
commit 3aa55db86d
1 changed files with 5 additions and 2 deletions

View File

@ -203,11 +203,14 @@ void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) {
// We can never place more than ColumnLimit / 3 items in a row (because of the
// spaces and the comma).
for (unsigned Columns = 1; Columns <= Style.ColumnLimit / 3; ++Columns) {
unsigned MaxItems = Style.ColumnLimit / 3;
std::vector<unsigned> MinSizeInColumn;
MinSizeInColumn.reserve(MaxItems);
for (unsigned Columns = 1; Columns <= MaxItems; ++Columns) {
ColumnFormat Format;
Format.Columns = Columns;
Format.ColumnSizes.resize(Columns);
std::vector<unsigned> MinSizeInColumn(Columns, UINT_MAX);
MinSizeInColumn.assign(Columns, UINT_MAX);
Format.LineCount = 1;
bool HasRowWithSufficientColumns = false;
unsigned Column = 0;