https://bugs.llvm.org/show_bug.cgi?id=35276
Bug ID: 35276
Summary: Incorrect formatting in presence of preprocessor
directives surrounding a comment
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: artemiev.mikh...@gmail.com
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
The formatting goes wrong with the following example.
$ cat test.cpp
class A {
public:
A(const A &a) : data_(a.data_) {
#ifdef FOO
doStuff();
#endif
}
A(A && a) : data_(std::move(a.data_)) {
#ifdef FOO
// placeholder
#endif
}
A(const A& a, int len) {
#ifdef FOO
doOtherStuff();
#endif
}
}
$ bin/clang-format -style=llvm test.cpp | tee test_fmt.cpp
class A {
public:
A(const A &a) : data_(a.data_) {
#ifdef FOO
doStuff();
#endif
}
A(A &&a)
: data_(std::move(a.data_)){
#ifdef FOO
// placeholder
#endif
} A(const A &a, int len) {
#ifdef FOO
doOtherStuff();
#endif
}
}
$ diff -u test.cpp test_fmt.cpp
--- test.cpp
+++ test_fmt.cpp
@@ -5,12 +5,12 @@
doStuff();
#endif
}
- A(A && a) : data_(std::move(a.data_)) {
+ A(A &&a)
+ : data_(std::move(a.data_)){
#ifdef FOO
// placeholder
#endif
- }
- A(const A& a, int len) {
+ } A(const A &a, int len) {
#ifdef FOO
doOtherStuff();
#endif
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs