https://bugs.llvm.org/show_bug.cgi?id=41783
Bug ID: 41783
Summary: [clang-format] BreakConstructorInitializers doesn't
preserve NOLINT comments
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: dennis.fels...@sap.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
$ 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs