-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
Description
Clang Format doesn't respect its AlignAfterOpenBracket
options when formatting multi-line for loops.
Here is a piece of code it produces when AlignAfterOpenBracket
is set to BlockIndent
void SmoothenMountainsPass::smoothen_mountains(
TileMap &tilemap, std::uint32_t step_i
) {
std::vector<std::pair<TilePos, Tile>> replacements;
for (std::uint8_t chunk_x = 0; chunk_x < tilemap.get_size(); ++chunk_x) {
for (std::uint8_t chunk_y = 0; chunk_y < tilemap.get_size();
++chunk_y) {
for (std::uint8_t local_x = 0; local_x < Chunk::size; ++local_x) {
for (std::uint8_t local_y = 0; local_y < Chunk::size;
++local_y) {
TilePos pos{chunk_x, chunk_y, local_x, local_y};
smoothen_mountains_tile(tilemap, pos, step_i, replacements);
}
}
}
}
}
The function parameter's format is OK, but the for loops aren't, it should be something like:
void SmoothenMountainsPass::smoothen_mountains(
TileMap &tilemap, std::uint32_t step_i
) {
std::vector<std::pair<TilePos, Tile>> replacements;
for (std::uint8_t chunk_x = 0; chunk_x < tilemap.get_size(); ++chunk_x) {
for (std::uint8_t chunk_y = 0; chunk_y < tilemap.get_size();
++chunk_y
) {
for (std::uint8_t local_x = 0; local_x < Chunk::size; ++local_x) {
for (std::uint8_t local_y = 0; local_y < Chunk::size;
++local_y
) {
TilePos pos{chunk_x, chunk_y, local_x, local_y};
smoothen_mountains_tile(tilemap, pos, step_i, replacements);
}
}
}
}
}