1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Teach the table generator to not generate switch statements containing only a default label with no cases. This solves some warnings with MSVC.

No functional changes intended.

llvm-svn: 208694
This commit is contained in:
Aaron Ballman 2014-05-13 12:52:35 +00:00
parent ff71d5baa3
commit a4fce68290

View File

@ -1008,20 +1008,23 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
O << "void " << Target.getName() << ClassName << "::"
<< "printCustomAliasOperand(\n"
<< " const MCInst *MI, unsigned OpIdx,\n"
<< " unsigned PrintMethodIdx, raw_ostream &OS) {\n"
<< " switch (PrintMethodIdx) {\n"
<< " default:\n"
<< " llvm_unreachable(\"Unknown PrintMethod kind\");\n"
<< " break;\n";
for (unsigned i = 0; i < PrintMethods.size(); ++i) {
O << " case " << i << ":\n"
<< " " << PrintMethods[i] << "(MI, OpIdx, OS);\n"
<< " unsigned PrintMethodIdx, raw_ostream &OS) {\n";
if (PrintMethods.empty())
O << " llvm_unreachable(\"Unknown PrintMethod kind\");\n";
else {
O << " switch (PrintMethodIdx) {\n"
<< " default:\n"
<< " llvm_unreachable(\"Unknown PrintMethod kind\");\n"
<< " break;\n";
}
O << " }\n"
<< "}\n\n";
for (unsigned i = 0; i < PrintMethods.size(); ++i) {
O << " case " << i << ":\n"
<< " " << PrintMethods[i] << "(MI, OpIdx, OS);\n"
<< " break;\n";
}
O << " }\n";
}
O << "}\n\n";
O << "#endif // PRINT_ALIAS_INSTR\n";
}