leonardchan added inline comments.

================
Comment at: lib/Sema/SemaExpr.cpp:14249
+
+    if (Sema::TypeHasNoDeref(Inner))
+      DeclRef = E;
----------------
aaron.ballman wrote:
> leonardchan wrote:
> > 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. 
> I think you have to do the desugaring manually in a loop with 
> `getSingleStepDesugaredType()` so that you don't strip off attributed type 
> information along with the rest of the type sugar.
> 
> > Also I tested with your example and the warning still seems to be thrown 
> > appropriately.
> 
> The example may depend on where you put the attribute (inside the parens vs 
> outside the parens, for instance); it was an off-the-cuff example, so it may 
> need some tweaking.
Done. Also added different variations of your example to the tests.


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