[PATCH] D31177: [ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and objective-c object pointer

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 13:05:35 PDT 2017


ahatanak added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:9431
+             ? 2
+             : 1)) {
       if (convertPointersToCompositeType(*this, Loc, LHS, RHS))
----------------
It wasn't clear to me why the code has to be added to the right hand side of the >= operator.

Is it equivalent to adding the following code, which I think is easier to understand? I'm assuming you are trying to avoid executing the statement when ObjCAutoRefCount is true and either LHSType or RHSType is an objc pointer type.

```
&& (!LangOpts.ObjCAutoRefCount || (!LHSType->isObjCObjectPointerType() && !RHSType->isObjCObjectPointerType()))
```


Repository:
  rL LLVM

https://reviews.llvm.org/D31177





More information about the cfe-commits mailing list