https://bugs.llvm.org/show_bug.cgi?id=48496
Bug ID: 48496
Summary: clang-format: changes when reformatting one line of
formatted file
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: barabas.raf...@gmail.com
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
Test case is as follows (add to
clang/unittests/Format/FormatTestSelective.cpp):
TEST_F(FormatTestSelective, Bug) {
Style.AlignConsecutiveDeclarations = true;
Style.ColumnLimit = 16;
std::string Code = "int b(void);\n"
"int u(int, int);\n"
"bool g(void);";
std::string Full = format(Code, 0, Code.length());
std::string First = format(Full, 0, 0);
EXPECT_EQ(Full, First);
}
Test result:
Expected: Full
Which is: "int b(void);\nint u(int, int);\nbool g(void);"
To be equal to: First
Which is: "int b(void);\nint u(int, int);\nbool g(void);"
With diff:
@@ -1,3 +1,3 @@
-int b(void);
+int b(void);
int u(int, int);
bool g(void);
Expected result:
There are no changes when reformatting the first line.
Another thing to note is that u is not aligned to g. It could be, if the
parameters were moved to the next line. This is what happens when u is changed
to uu, making that line longer than the ColumnLimit.
The bug is present on the main branch at commit
8e6fc1f97eb9a63780158470596ddbec3d0ecd59
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs