llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.09k stars 12k forks source link

incorrect indentation of arguments of a function call when the function name start on the next IndentWidth. #43824

Open 60493a66-ecf0-4a8f-9c5b-92788fd2621c opened 4 years ago

60493a66-ecf0-4a8f-9c5b-92788fd2621c commented 4 years ago
Bugzilla Link 44479
Version 9.0
OS Linux
CC @alfonso-soto,@zygoloid

Extended Description

---- INPUT ----- void normalFunctionName() { if (functionName(loooooooooooongParam1, loooooooooooooongParam2, looooooooooongParam3)) { return; } }

---- EXPECTED OUTPUT ---- void normalFunctionName() { if (functionName( loooooooooooongParam1, loooooooooooooongParam2, looooooooooongParam3)) { return; } }

---- CLANG-FORMAT OUTPUT---- (extra indentation on the arguments) void normalFunctionName() { if (functionName( loooooooooooongParam1, loooooooooooooongParam2, looooooooooongParam3)) { return; } }

The result have an extra indentation on the arguments of 4 spaces. This happens always that the name of the function call starts on the next indentation (8 spaces). The indentation should not be measure base on the function name, should be measured starting with the <> statement.

---- Related clang-format rules ---- BasedOnStyle: WebKit

ColumnLimit: 80 IndentWidth: 4 ContinuationIndentWidth: 8

AlignAfterOpenBracket: AlwaysBreak AllowAllParametersOfDeclarationOnNextLine: false AllowAllArgumentsOnNextLine: false AlwaysBreakAfterReturnType: None BinPackParameters: false BinPackArguments: false ExperimentalAutoDetectBinPacking: false

363c25d2-3eea-458f-b068-25de02ca56aa commented 4 years ago

I have been able to reproduce it with clang-format 9.0.0.