<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88888>88888</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Different indentation format with and without `-lines` parameter and user defined `Macros:`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CDAlexanderW
</td>
</tr>
</table>
<pre>
### Environment
The tested v19 clang-format executable was built from source of 13.03.2024. Also tested with clang-format 17.0.3.
Setting in .clang-format is:
```
Language: Cpp
Macros:
# Avoid reference and pointer parameters being formatted as if &, * etc. are operators
- MOCK_METHOD(a,b,c)=a;b;c
- MOCK_METHOD(a,b,c,d)=a;b;c;d
```
### Problem
File: problem.h
```cpp
class myMock {
public:
MOCK_METHOD(std::unique_ptr<MyReturnValueThingy>, MyFunctionName,
(const ParamType1 *param1, const ParamType2 *param2), (override));
void f() {}
};
```
#### With line
Call with lines argument
```
clang-format.exe" -lines 5:5 .\problem.h
```
formats to:
```cpp
class myMock {
public:
MOCK_METHOD(std::unique_ptr<MyReturnValueThingy>, MyFunctionName,
(const ParamType1 *param1, const ParamType2 *param2), (override));
void f() {}
};
```
#### Without line
Call without lines argument
```
clang-format.exe" .\problem.h
```
formats to:
```cpp
class myMock {
public:
MOCK_METHOD(std::unique_ptr<MyReturnValueThingy>, MyFunctionName,
(const ParamType1 *param1, const ParamType2 *param2), (override));
void f() {}
};
```
We expect f() to be formatted (indentation) in both cases (whole file and one line) the same way. The correct format seems to be the one of the whole file format.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVk-PqzYQ_zTOZbQIbELCgUOWbFSpTd9Tu-oen4wZwK2xqW12N9--MmSzJNpXtVWfeqiFEvD88czvN_aYOydbjViQ9T1Z71d89J2xRbnfKXzlukb7tKpMfSoIZfMDD_pZWqN71J7EexLv5t_HDsGj81jDc5KDUFy3d42xP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