[PATCH] D23079: ObjC: Use a new type for ObjC type parameter (patch 2 out of 3)

Doug Gregor via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 15:46:42 PDT 2016


doug.gregor added inline comments.

================
Comment at: include/clang/AST/RecursiveASTVisitor.h:1037
@@ -1036,1 +1036,3 @@
 
+DEF_TRAVERSE_TYPE(ObjCTypeParamType, {})
+
----------------
manmanren wrote:
> doug.gregor wrote:
> > I'm sorta shocked that we don't visit the protocol qualifiers here, but I guess we haven't been doing that for ObjCObjectType all along. Weird.
> Right below, we don't visit the protocol qualifiers for ObjCObjectType :]
> If you think we should, I can patch it up for both types.
Yes, I think we should.

================
Comment at: include/clang/AST/Type.h:4786
@@ +4785,3 @@
+  bool isSugared() const { return false; }
+  QualType desugar() const { return QualType(this, 0); }
+
----------------
manmanren wrote:
> doug.gregor wrote:
> > This is an interesting choice. Objective-C type parameters were treated like typedefs before, so they always act like their underlying type (e.g., because they are typedef name declarations). Why isn't ObjCTypeParamType sugar for the underlying type of the type parameter (I.e., the bound) w/ the protocol qualifiers?
> Are you suggesting to canonicalize ObjCTypeParamType to the underlying type with the protocol qualifiers as well? Or just desugaring?
> 
> I think I have tried to set ObjCTypeParamType as NON_CANONICAL_TYPE in TypeNodes.def, but had some issues.
Canonicalize to the underlying type + protocol qualifiers. We don't need the desugaring part.


https://reviews.llvm.org/D23079





More information about the cfe-commits mailing list