[cfe-commits] r121084 - in /cfe/trunk/lib: AST/StmtPrinter.cpp Parse/ParseExprCXX.cpp

John McCall rjmccall at apple.com
Tue Dec 7 10:20:52 PST 2010


On Dec 7, 2010, at 1:28 AM, Abramo Bagnara wrote:
> Il 07/12/2010 01:55, Francois Pichet ha scritto:
>> Author: fpichet
>> Date: Mon Dec  6 18:55:57 2010
>> New Revision: 121084
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=121084&view=rev
>> Log:
>> Fix enumerator not handled in switch warnings.
>> 
>> Modified:
>>    cfe/trunk/lib/AST/StmtPrinter.cpp
>>    cfe/trunk/lib/Parse/ParseExprCXX.cpp
>> 
>> Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=121084&r1=121083&r2=121084&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
>> +++ cfe/trunk/lib/AST/StmtPrinter.cpp Mon Dec  6 18:55:57 2010
>> @@ -1206,6 +1206,7 @@
>> 
>> static const char *getTypeTraitName(UnaryTypeTrait UTT) {
>>   switch (UTT) {
>> +  default: llvm_unreachable("Unknown unary type trait");
>>   case UTT_HasNothrowAssign:      return "__has_nothrow_assign";
>>   case UTT_HasNothrowCopy:        return "__has_nothrow_copy";
>>   case UTT_HasNothrowConstructor: return "__has_nothrow_constructor";
>> @@ -1222,15 +1223,14 @@
>>   case UTT_IsPolymorphic:         return "__is_polymorphic";
>>   case UTT_IsUnion:               return "__is_union";
>>   }
>> -  llvm_unreachable("Unknown unary type trait");
>>   return "";
>> }
> 
> Begin to run... I think that Doug and John are going to kill you :-D

Heh.  Using a default case for ParseExprCXX.cpp is reasonable;  there's no point
in exhaustively matching over token kinds, we just have to know the tokens we care
about.  This example, on the other hand, really seems like it should have an
exhaustive switch.

John.



More information about the cfe-commits mailing list