leonardchan added a comment.

@rsmith



================
Comment at: lib/Sema/SemaExpr.cpp:14249
+
+    if (Sema::TypeHasNoDeref(Inner))
+      DeclRef = E;
----------------
aaron.ballman wrote:
> The sugar was stripped off at the pointer level, but not at the pointee 
> level. e.g.,
> ```
> typedef int (bobble);
> typedef bobble * (frobble);
> typedef frobble * yobble;
> 
> yobble gobble;
> ```
> I think you can handle this within `TypeHasNoDeref()` and that should fix up 
> all the callers.
So `TypeHasNoDeref()` checks for the attribute on the base type already and is 
called after the pointer is stripped off. Attempting to desugar via 
`getDesugaredType()` here also removes the `address_space` attribute from the 
type I'm checking.

Do you know another method that essentially "expands" the typedefs without 
stripping the qualifiers? Otherwise I think I do need do the desugaring at the 
pointer level. Alternatively I could also change this method such that it 
accepts pointers instead of pointees since it appears I already call 
`getDesugaredType()` for almost every pointer who's pointee I'm passing to 
`TypeHasNoDeref()`.

Also I tested with your example and the warning still seems to be thrown 
appropriately. 


Repository:
  rC Clang

https://reviews.llvm.org/D49511



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

Reply via email to