[cfe-commits] r72598 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/Type.cpp

Eli Friedman eli.friedman at gmail.com
Fri May 29 17:26:32 PDT 2009


On Fri, May 29, 2009 at 5:14 PM, Douglas Gregor<dgregor at apple.com> wrote:
>> --- cfe/trunk/lib/AST/Type.cpp (original)
>> +++ cfe/trunk/lib/AST/Type.cpp Fri May 29 19:10:16 2009
>> @@ -896,6 +896,19 @@
>>  return false;
>> }
>>
>> +bool Type::isSpecifierType() const {
>> +  // Note that this intentionally does not use the canonical type.
>> +  switch (getTypeClass()) {
>> +  case Builtin:
>> +  case Record:
>> +  case Enum:
>> +  case Typedef:
>> +    return true;
>> +  default:
>> +    return false;
>> +  }
>> +}
>
> Wouldn't it be easier to enumerate the non-specifier types? Pointers, lvalue
> references, rvalue references, array types, and then the result types of
> function types.

There's pointers (regular, block, and member), extended qualifiers,
references (l and r), array types (constant, incomplete, and
variable), function types (with and without prototypes), and vector
types (both regular and extended), off the top of my head.  I think
this way ends up being a bit shorter.

-Eli




More information about the cfe-commits mailing list