[PATCH] D120774: [clang-format] Handle builtins in constraint expression
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 3 03:56:25 PST 2022
curdeius accepted this revision.
curdeius added a comment.
This revision is now accepted and ready to land.
Thanks for handling other traits! LGTM % alias test.
================
Comment at: clang/unittests/Format/FormatTest.cpp:23747
+ verifyFormat("template <class T>\n"
+ "concept integral = __is_integral(T);");
+
----------------
HazardyKnusperkeks wrote:
> HazardyKnusperkeks wrote:
> > curdeius wrote:
> > > curdeius wrote:
> > > > How about other kinds?
> > > > This doesn't seem to work for at least ARRAY_TYPE_TRAIT (e.g. `concept OneDimensionalArray = __array_rank(T) == 1;` and EXPRESSION_TRAIT.
> > > >
> > > > Is there a way to be more generic and treat all identifier-like entities like identifiers?
> > > I'd like to see a test for ALIASes as well, e.g. `__is_same_as`.
> > > How about other kinds?
> > > This doesn't seem to work for at least ARRAY_TYPE_TRAIT (e.g. `concept OneDimensionalArray = __array_rank(T) == 1;` and EXPRESSION_TRAIT.
> >
> > I was conservative, since I don't know what these kind of traits are. But sure can add.
> >
> > > Is there a way to be more generic and treat all identifier-like entities like identifiers?
> > Not that I know of. There is no such function in `TokenKind.h`.
> I have no idea how to handle the aliases, since there are many, and most are no traits, not correct here. We could add __is_same_as, as it seems to be the only trait alias, directly.
I don't think you need to treat them specially, they should behave as their aliased entity actually. But please test at least one.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120774/new/
https://reviews.llvm.org/D120774
More information about the cfe-commits
mailing list