https://bugs.llvm.org/show_bug.cgi?id=49868
Bug ID: 49868
Summary: Follow up on bug 46969: clang-format splits bitshift
operator >> into > >
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Bug 46969 (https://bugs.llvm.org/show_bug.cgi?id=46969) describes how
clang-format (version <= 11) can occasionally split a right-bitshift operator
(>>) into two angle-brackets by inserting a space in between (> >).
A patch for this issue has been submitted for release 12.x as per
https://reviews.llvm.org/D86581
The review comments acknowledge that some situations in which the bitshift
operator is split are not correctly resolved by the patch (due in part to the
ambiguity introduced by c++14 variable templates).
Since this issue is present in release 12.x and possibly in trunk, I am raising
it as a follow up bug report for 46969.
Consider this simple example which is incorrectly transformed by clang-format
even in release 12.x:
Original:
int main() {
int x = 0;
int y = 0;
return x < y - 1 >> 1;
}
After clang-format:
int main() {
int x = 0;
int y = 0;
return x < y - 1 > > 1; /*<< Code is broken*/
}
I was wondering if there are any mitigation strategies for this issue. This has
cropped up as a problem for developers of source-to-source compilers which emit
c and c++ code that subsequently needs to be formatted. The emitted code might
contain such ambiguous syntax and we would like clang-format to take a more
conservative approach to formatting if possible in order to avoid modifying the
original behavior of the program.
--
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