mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-17 08:21:13 +00:00
Fix a bug in the line merging.
If the first line of a merge would exactly fit into the column limit, an unsigned overflow made us not break. llvm-svn: 172426
This commit is contained in:
parent
2ab0d01a8e
commit
3e9218e50a
@ -1408,6 +1408,8 @@ private:
|
||||
unsigned Length = 0;
|
||||
if (!fitsIntoLimit(I->First, Limit, &Length))
|
||||
return false;
|
||||
if (Limit == Length)
|
||||
return true; // Couldn't fit a space.
|
||||
Limit -= Length + 1; // One space.
|
||||
if (I + 1 == E)
|
||||
return true;
|
||||
|
@ -138,6 +138,8 @@ TEST_F(FormatTest, FormatIfWithoutCompountStatement) {
|
||||
" f();");
|
||||
verifyFormat("if (a) return;", getLLVMStyleWithColumns(14));
|
||||
verifyFormat("if (a)\n return;", getLLVMStyleWithColumns(13));
|
||||
verifyFormat("if (aaaaaaaaa)\n"
|
||||
" return;", getLLVMStyleWithColumns(14));
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, ParseIfElse) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user