[PATCH] D32891: [Sema][ObjC++] Objective-C++ support for __is_base_of(B, D)

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 07:43:50 PDT 2017


arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.

LGTM! A couple of comments below:



================
Comment at: lib/Sema/SemaExprCXX.cpp:4725
+    if (!rhsRecord || !lhsRecord) {
+      const ObjCObjectType *lhsObjTy = LhsT->getAs<ObjCObjectType>();
+      const ObjCObjectType *rhsObjTy = RhsT->getAs<ObjCObjectType>();
----------------
Please capitalize `lhsObjTy` and `rhsObjTy`.


================
Comment at: test/SemaObjCXX/is-base-of.mm:14
+
+static_assert(!__is_base_of(NSObj *, NSChild *), "");
+static_assert(!__is_base_of(NSChild *, NSObj *), "");
----------------
I'd also add a test that verifies that `id` isn't a valid base, e.g:

```
static_assert(!__is_base_of(id, NSObj), "");
```


https://reviews.llvm.org/D32891





More information about the cfe-commits mailing list