[PATCH] D42408: [clang-format] Align preprocessor comments with #
Mark Zeren via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 22 22:26:58 PST 2018
mzeren-vmw created this revision.
mzeren-vmw added reviewers: krasimir, klimek, djasper.
r312125, which introduced preprocessor indentation, shipped with a known
issue where "indentation of comments immediately before indented
preprocessor lines is toggled on each run". For example these two forms
toggle:
#ifndef HEADER_H
#define HEADER_H
#if 1
// comment
# define A 0
#endif
#endif
#ifndef HEADER_H
#define HEADER_H
#if 1
// comment
# define A 0
#endif
#endif
This happens because we check vertical alignment against the '#' yet
indent to the level of the 'define'. This patch resolves this issue by
aligning against the '#'.
Repository:
rC Clang
https://reviews.llvm.org/D42408
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42408.131003.patch
Type: text/x-patch
Size: 5874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180123/921074fe/attachment-0001.bin>
More information about the cfe-commits
mailing list