Skip to content

clang-format QualifierAlignment=Right breaks qualifiers with MOCK_METHOD #154846

@banjo74

Description

@banjo74

Say I want to mock MyClass::myMethod using Google Mock:

class MyClass {
public:
  virtual ReturnType myMethod(int) const = 0;
};

I'd use:

MOCK_METHOD(ReturnType, myMethod, (int), (const override))

but clang-format with QualifierAlignment=Right turns that into:

MOCK_METHOD(ReturnType, myMethod, (int), (override const))

an error.

See documentation for Google Mock here:
https://google.github.io/googletest/reference/mocking.html

Metadata

Metadata

Assignees

Labels

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

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions