Index: lib/Format/WhitespaceManager.cpp =================================================================== --- lib/Format/WhitespaceManager.cpp +++ lib/Format/WhitespaceManager.cpp @@ -472,7 +472,8 @@ continue; unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn; - unsigned ChangeMaxColumn = Style.ColumnLimit >= Changes[i].TokenLength + unsigned ChangeMaxColumn = + Style.ColumnLimit == 0 || Style.ColumnLimit >= Changes[i].TokenLength ? Style.ColumnLimit - Changes[i].TokenLength : ChangeMinColumn; Index: unittests/Format/FormatTestComments.cpp =================================================================== --- unittests/Format/FormatTestComments.cpp +++ unittests/Format/FormatTestComments.cpp @@ -2476,6 +2476,13 @@ "int k; // line longg long", getLLVMStyleWithColumns(20))); + // Always align if Colums = 0 + EXPECT_EQ("int i, j; // line 1\n" + "int k; // line longg long", + format("int i, j; // line 1\n" + "int k; // line longg long", + getLLVMStyleWithColumns(0))); + // Align comment line sections aligned with the next token with the next // token. EXPECT_EQ("class A {\n"