mizvekov added inline comments.

================
Comment at: clang/include/clang/AST/Type.h:4537
   Expr *TOExpr;
+  bool IsUnqual;
 
----------------
You can use the Type Bitfields in order to avoid bumping the size of the node.



================
Comment at: clang/lib/AST/ASTContext.cpp:12910-12916
+    // FIXME:: is this assumption correct or do we need to do work here to find
+    // the common type sugar regarding the stripped qualifiers if only one side
+    // is unqual?
+    assert(cast<TypeOfType>(X)->isUnqual() == cast<TypeOfType>(Y)->isUnqual() 
&&
+           "typeof vs typeof_unqual mismatch?");
+    return Ctx.getTypeOfType(Ctx.getQualifiedType(Underlying),
+                             cast<TypeOfType>(X)->isUnqual());
----------------
erichkeane wrote:
> I'm unfamiliar with this function, but I would expect you MIGHT need to?  If 
> only because they are the same AST node.  Should 'unqual' version be its own 
> node?  I'm on the fence, as it is a LOT of code to do so, but also ends up 
> being simpler in many places.
A qualified and an unqualified typeof could have the same underlying type, so 
this assert can trip.

I think what makes most sense is to unify them to a qualified typeof in case 
they differ, as that holds the underlying type unchanged:
```
    return Ctx.getTypeOfType(Ctx.getQualifiedType(Underlying),
                             cast<TypeOfType>(X)->isUnqual() && 
cast<TypeOfType>(Y)->isUnqual());
```


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

https://reviews.llvm.org/D134286

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

Reply via email to