-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
Bugzilla Link | 41783 |
Version | trunk |
OS | Linux |
CC | @mydeveloperday |
Extended Description
$ cat .clang-format
Language: Cpp
BreakConstructorInitializers: AfterColon
CommentPragmas: 'NOLINT'
$ cat x.cpp
class C
{
public:
C(C&& rhs) : // NOLINT(performance-noexcept-move-constructor)
x(rhs.x),
y(rhs.y)
{}
private:
int x;
int y;
};
$ clang-format x.cpp
class C {
public:
C(C &&rhs) :
// NOLINT(performance-noexcept-move-constructor)
x(rhs.x), y(rhs.y) {}
private:
int x;
int y;
};
After clang-format's reformatting the NOLINT marker loses its meaning for clang-tidy. In this instance a NOLINTNEXTLINE could be used instead as a workaround from clang-tidy's side.
Unfortunately even CommentPragma can't preserve the comment on the same line. The only workaround I found is setting BreakConstructorInitializers: BeforeComma, but in our case this is not wished.
Ideally the comment would stay on the same line and only the x(rhs.x), ... part be broken over to the next line.