[cfe-commits] r115713 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/typeof-use-deprecated.c

John McCall rjmccall at apple.com
Tue Oct 5 16:52:51 PDT 2010


On Oct 5, 2010, at 4:24 PM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Tue Oct  5 18:24:00 2010
> New Revision: 115713
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=115713&view=rev
> Log:
> Issue deprecated warning when typeof uses an
> expression of deprecated type.

This seems strange to me;  deprecation warnings are usually based on how something is spelled, not what it actually resolves to.  For example, even if a record type is deprecated, you can still make variables of that type if you have a non-deprecated typedef for it.  So if the variable itself isn't deprecated, I'm not sure why getting its type with typeof is more suspect than any other use.  Is there a specific use case motivating this?

There are a lot of subsidiary questions here, like whether we should warn in the following test cases:
  deprecated_type *a; typeof(*a) b;  // we now warn about this
  deprecated_type *a; typeof(a) b;  // but not about this
  deprecated_typedef a; typeof(a) b;  // or this
etc.

Also, you can just use getAs<TagType>() instead of testing for RecordType and EnumType separately.

John.



More information about the cfe-commits mailing list