[PATCH] D65227: clang-format: Support `if CONSTEXPR` if CONSTEXPR is a macro.
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 10:29:00 PDT 2019
thakis created this revision.
thakis added a reviewer: klimek.
This is like r305666 (which added support for `if constexpr`) except
that it allows a macro name after the if.
This is slightly tricky for two reasons:
1. r305666 didn't add test coverage for all cases where it added a kw_constexpr, so I had to figure out what all the added cases were for. I now added tests for all `if consexpr` bits that didn't have tests. (This took a while, see e.g. https://reviews.llvm.org/D65223)
2. Parsing 'if <ident> (` as an if means that `#if defined(` and `#if __has_include(` parse as ifs too. Add some special-case code to prevent this from happening where it's incorrect.
Fixes PR39248.
https://reviews.llvm.org/D65227
Files:
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/FormatToken.h
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65227.211554.patch
Type: text/x-patch
Size: 12978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190724/29852c16/attachment.bin>
More information about the cfe-commits
mailing list