Skip to content

[clang-format] RemoveParentheses option removes necessary parentheses of Google Mock macro #138124

@JeroenBrunnenkreef

Description

@JeroenBrunnenkreef

I've got the RemoveParentheses option of clang-format set to MultipleParentheses. If I then format a file containing a Google Mock MOCK_METHOD macro, it removes parentheses that are necessary.

Example before format (correct code):
MOCK_METHOD(void, Function, (), (override));

Example after format (does not compile):
MOCK_METHOD(void, Function, , override);

clang-format version: 21.0.0git (shipped with CLion 2025.1)
Google Test framework version: 1.15.0

Metadata

Metadata

Assignees

Labels

clang-formatinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compiles

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions