[llvm-bugs] [Bug 43648] New: Comments after preprocessor directives are misaligned to code-level
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 11 07:27:32 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43648
Bug ID: 43648
Summary: Comments after preprocessor directives are misaligned
to code-level
Product: clang
Version: 9.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: clemensgru at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Comments before preprocessor directives are correctly identified as belonging
to the directive and are not aligned to code-level.
The line '// FOO begins' in the following example is not changed by
clang-format. This works as expected.
void main(void) {
int i = 0;
// FOO begins
#ifdef FOO
i++;
#endif
// FOO ends
}
However, clang-format (tested with version 9.0.0) does indent the line '// FOO
ends', which is not correct in my opinion. Similar to a namespace end comment,
this tells readers which ifdef this endif is closing and should be aligned with
the directive, or at least be preserved if it is already aligned that way.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191011/77b06a4c/attachment-0001.html>
More information about the llvm-bugs
mailing list