[PATCH] D116280: [clang] adds unary type trait checks as compiler built-ins
Christopher Di Bella via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 16 23:17:41 PDT 2022
cjdb added inline comments.
================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:4889-4890
return T->isArrayType();
+ case UTT_IsBoundedArray:
+ return T->isArrayType() && !T->isIncompleteArrayType();
+ case UTT_IsUnboundedArray:
----------------
aaron.ballman wrote:
> Is a VLA a bounded array? (We support those as an extension in C++, unfortunately.)
`__is_bounded_array(T)` is true when "`T` is an array type of known bound". Do VLAs meet this criteria?
================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5289
+ if (UTT == UTT_IsCopyAssignable) {
+ return EvaluateBinaryTypeTrait(Self, BTT_IsAssignable, Self.BuildReferenceType(T, true, KeyLoc, T.getBaseTypeIdentifier()), AssigneeType, KeyLoc);
+ }
----------------
aaron.ballman wrote:
> It looks like this file could stand to be clang formatted.
Yeah, there was a time where `arc diff` did the formatting automatically, but it seems that day has passed :(
================
Comment at: clang/test/SemaCXX/type-traits.cpp:764
+ int t30[F(__is_bounded_array(void*))];
+ int t31[F(__is_bounded_array(cvoid*))];
+}
----------------
aaron.ballman wrote:
> Any reason there's not a test with something like `int[10]` and `int[]`? (Same below.)
Those are `IntAr` and `IntArNB` at the very top. I can rename those if you'd like.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116280/new/
https://reviews.llvm.org/D116280
More information about the cfe-commits
mailing list