[PATCH] D47519: [clang-format] Detect amp type as TT_PointerOrReference in function annotations
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 6 06:17:14 PDT 2018
krasimir added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:1566
- if (PrevToken->is(tok::coloncolon))
+ if (PrevToken->isOneOf(tok::coloncolon, tok::kw_const))
return TT_PointerOrReference;
----------------
I'd also check for `volatile` here, for example for (+ add it as test):
```
auto x() volatile& noexcept -> bool {}
```
================
Comment at: lib/Format/TokenAnnotator.cpp:1590
+ tok::kw_typeof, tok::kw_decltype, TT_FunctionDeclarationName,
+ TT_StartOfName, TT_OverloadedOperator))
return TT_PointerOrReference;
----------------
Sorry, I don't follow which of the added tests exercise which of the added cases. Could you please elaborate?
================
Comment at: unittests/Format/FormatTest.cpp:6164
+ verifyGoogleFormat("template <typename T>\n"
+ "auto operator+() &MACRO {}");
}
----------------
Do you have a real-world example of this kind of macro? I'd leave it off if not.
Repository:
rC Clang
https://reviews.llvm.org/D47519
More information about the cfe-commits
mailing list