https://bugs.llvm.org/show_bug.cgi?id=43770
Bug ID: 43770
Summary: clang-format: PointerAlignment removes space within
multiple lambda declarations
Product: new-bugs
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
app.cpp:
#include <functional>
int main() {
std::function<int(int const&)> res1 = [](int const& a) { return a * 2; },
res2 = [](int const& a) { return a * 2; };
return res1(2) + res2(4);
}
$ clang-format app.cpp -style='{PointerAlignment: Left}'
#include <functional>
int main() {
std::function<int(int const&)> res1 = [](int const&a) { return a * 2; },
res2 = [](int const&a) { return a * 2; };
return res1(2) + res2(4);
}
$ clang-format app.cpp -style='{PointerAlignment: Middle}'
#include <functional>
int main() {
std::function<int(int const &)> res1 = [](int const &a) { return a * 2; },
res2 = [](int const &a) { return a * 2; };
return res1(2) + res2(4);
}
$ clang-format app.cpp -style='{PointerAlignment: Right}'
#include <functional>
int main() {
std::function<int(int const &)> res1 = [](int const &a) { return a * 2; },
res2 = [](int const &a) { return a * 2; };
return res1(2) + res2(4);
As we can see, space on right side is removed, while it shouldn't always be
removed.
It behaves fine if we split res1 and rest2 type declarations.
app2.cpp:
#include <functional>
int main() {
std::function<int(int const&)> res1 = [](int const& a) { return a * 2; };
std::function<int(int const&)> res2 = [](int const& a) { return a * 2; };
return res1(2) + res2(4);
}
$ clang-format app2.cpp -style='{PointerAlignment: Left}'
#include <functional>
int main() {
std::function<int(int const&)> res1 = [](int const& a) { return a * 2; };
std::function<int(int const&)> res2 = [](int const& a) { return a * 2; };
return res1(2) + res2(4);
}
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs