On Feb 12, 2010, at 12:58 AM, Sebastian Redl wrote:

> 
> On Fri, 12 Feb 2010 03:41:31 -0000, John McCall <[email protected]>
> wrote:
>> Author: rjmccall
>> Date: Thu Feb 11 21:41:30 2010
>> New Revision: 95964
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=95964&view=rev
>> Log:
>> Waste two bits in every clang::Type so that the type class can be read
>> in a single byte-load rather than some crazy bitmunging operation.
>> 
>> 
> ==============================================================================
>> --- cfe/trunk/include/clang/AST/Type.h (original)
>> +++ cfe/trunk/include/clang/AST/Type.h Thu Feb 11 21:41:30 2010
>> @@ -751,24 +751,22 @@
>> public:
>>   enum TypeClass {
>> #define TYPE(Class, Base) Class,
>> +#define LAST_TYPE(Class) TypeLast = Class,
>> #define ABSTRACT_TYPE(Class, Base)
>> #include "clang/AST/TypeNodes.def"
> 
> How about
> 
> + TypeBeyondLast,
> + TypeLast = TypeBeyondLast - 1,
> 
> and leaving TypeNodes.def alone?

If we do that, we'll get -Wswitch warnings for every switch-on-type-class we 
do, and have to add

        case Type::TypeLast: llvm_unreachable("impossible!");

in a bunch of places. Since it's only a small amount of effort required to 
avoid this particular issue, I think I prefer John's solution.

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to