vsapsai planned changes to this revision.
vsapsai added inline comments.

================
Comment at: clang/lib/AST/Type.cpp:1295
+
+  QualType VisitObjCObjectType(const ObjCObjectType *objType) {
+    if (!objType->isKindOfType())
----------------
erik.pilkington wrote:
> Does this works with type sugar? i.e. previously calling 
> `Ty->getAs<ObjCObjectType>()` would have stripped through `TypedefType`, but 
> its not obvious to me that this traversal is doing the right thing for that 
> case.
You are right, great catch. And I have a test case to confirm that.

I've started this refactoring to avoid copy-pasting

```lang=c++
    QualType modifiedType = recurse(T->getModifiedType());
    if (modifiedType.isNull())
      return {};

    QualType equivalentType = recurse(T->getEquivalentType());
    if (equivalentType.isNull())
      return {};

    if (modifiedType.getAsOpaquePtr()
          == T->getModifiedType().getAsOpaquePtr() &&
        equivalentType.getAsOpaquePtr()
          == T->getEquivalentType().getAsOpaquePtr())
      return QualType(T, 0);
```

and use `BaseType::VisitAttributedType(attrType)` instead. I think it is 
possible to achieve the previous behaviour with the traditional recursive 
visitor. But ideas that I have are pretty complicated and I don't think that's 
the right trade-off.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57075/new/

https://reviews.llvm.org/D57075



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to