[Lldb-commits] [lldb] r128177 - /lldb/trunk/source/Interpreter/CommandObject.cpp
Caroline Tice
ctice at apple.com
Wed Mar 23 15:31:13 PDT 2011
Author: ctice
Date: Wed Mar 23 17:31:13 2011
New Revision: 128177
URL: http://llvm.org/viewvc/llvm-project?rev=128177&view=rev
Log:
Add missing cases to switch statements & remove 'default'.
Modified:
lldb/trunk/source/Interpreter/CommandObject.cpp
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=128177&r1=128176&r2=128177&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Wed Mar 23 17:31:13 2011
@@ -520,10 +520,6 @@
const char *second_name = GetArgumentName (arg_entry[1].arg_type);
switch (arg_entry[0].arg_repetition)
{
- default:
- // Silence clang warnings.
- // Only pair enums are reachable.
- break;
case eArgRepeatPairPlain:
str.Printf ("<%s> <%s>", first_name, second_name);
break;
@@ -542,6 +538,15 @@
case eArgRepeatPairRangeOptional:
str.Printf ("[<%s_1> <%s_1> ... <%s_n> <%s_n>]", first_name, second_name, first_name, second_name);
break;
+ // Explicitly test for all the rest of the cases, so if new types get added we will notice the
+ // missing case statement(s).
+ case eArgRepeatPlain:
+ case eArgRepeatOptional:
+ case eArgRepeatPlus:
+ case eArgRepeatStar:
+ case eArgRepeatRange:
+ // These should not be reached, as they should fail the IsPairType test above.
+ break;
}
}
else
@@ -555,10 +560,6 @@
}
switch (arg_entry[0].arg_repetition)
{
- default:
- // Silence clang warnings.
- // Only non-pair enums are reachable.
- break;
case eArgRepeatPlain:
str.Printf ("<%s>", names.GetData());
break;
@@ -573,6 +574,18 @@
break;
case eArgRepeatRange:
str.Printf ("<%s_1> .. <%s_n>", names.GetData());
+ break;
+ // Explicitly test for all the rest of the cases, so if new types get added we will notice the
+ // missing case statement(s).
+ case eArgRepeatPairPlain:
+ case eArgRepeatPairOptional:
+ case eArgRepeatPairPlus:
+ case eArgRepeatPairStar:
+ case eArgRepeatPairRange:
+ case eArgRepeatPairRangeOptional:
+ // These should not be hit, as they should pass the IsPairType test above, and control should
+ // have gone into the other branch of the if statement.
+ break;
}
}
}
More information about the lldb-commits
mailing list