mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
Remove RequireDefault parameter from EmitCaseConstructHandler.
There are now no situations when 'default' is required. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51746 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -762,12 +762,11 @@ void EmitCaseTest(const DagInit& d, const char* IndentLevel,
|
|||||||
// void F(Init* Statement, const char* IndentLevel, std::ostream& O).
|
// void F(Init* Statement, const char* IndentLevel, std::ostream& O).
|
||||||
template <typename F>
|
template <typename F>
|
||||||
void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
|
void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
|
||||||
const F& Callback, bool DefaultRequired,
|
const F& Callback,
|
||||||
const GlobalOptionDescriptions& OptDescs,
|
const GlobalOptionDescriptions& OptDescs,
|
||||||
std::ostream& O) {
|
std::ostream& O) {
|
||||||
assert(d->getOperator()->getAsString() == "case");
|
assert(d->getOperator()->getAsString() == "case");
|
||||||
|
|
||||||
bool DefaultProvided = false;
|
|
||||||
unsigned numArgs = d->getNumArgs();
|
unsigned numArgs = d->getNumArgs();
|
||||||
if (d->getNumArgs() < 2)
|
if (d->getNumArgs() < 2)
|
||||||
throw "There should be at least one clause in the 'case' expression:\n"
|
throw "There should be at least one clause in the 'case' expression:\n"
|
||||||
@@ -778,7 +777,6 @@ void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
|
|||||||
|
|
||||||
// Emit the test.
|
// Emit the test.
|
||||||
if (Test.getOperator()->getAsString() == "default") {
|
if (Test.getOperator()->getAsString() == "default") {
|
||||||
DefaultProvided = true;
|
|
||||||
if (i+2 != numArgs)
|
if (i+2 != numArgs)
|
||||||
throw std::string("The 'default' clause should be the last in the"
|
throw std::string("The 'default' clause should be the last in the"
|
||||||
"'case' construct!");
|
"'case' construct!");
|
||||||
@@ -799,10 +797,6 @@ void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
|
|||||||
Callback(d->getArg(i), IndentLevel, O);
|
Callback(d->getArg(i), IndentLevel, O);
|
||||||
O << IndentLevel << "}\n";
|
O << IndentLevel << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DefaultRequired && !DefaultProvided)
|
|
||||||
throw "Case expression: the 'default' clause is required in this case:\n"
|
|
||||||
+ d->getAsString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitForwardOptionPropertyHandlingCode - Helper function used to
|
/// EmitForwardOptionPropertyHandlingCode - Helper function used to
|
||||||
@@ -1036,7 +1030,7 @@ void EmitGenerateActionMethod (const ToolProperties& P,
|
|||||||
else
|
else
|
||||||
EmitCaseConstructHandler(&InitPtrToDag(P.CmdLine), Indent2,
|
EmitCaseConstructHandler(&InitPtrToDag(P.CmdLine), Indent2,
|
||||||
EmitCmdLineVecFillCallback(Version, P.Name),
|
EmitCmdLineVecFillCallback(Version, P.Name),
|
||||||
false, OptDescs, O);
|
OptDescs, O);
|
||||||
|
|
||||||
// For every understood option, emit handling code.
|
// For every understood option, emit handling code.
|
||||||
for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
|
for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
|
||||||
@@ -1337,7 +1331,7 @@ void EmitEdgeClass (unsigned N, const std::string& Target,
|
|||||||
<< Indent2 << "unsigned ret = 0;\n";
|
<< Indent2 << "unsigned ret = 0;\n";
|
||||||
|
|
||||||
// Handle the 'case' construct.
|
// Handle the 'case' construct.
|
||||||
EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O);
|
EmitCaseConstructHandler(Case, Indent2, IncDecWeight, OptDescs, O);
|
||||||
|
|
||||||
O << Indent2 << "return ret;\n"
|
O << Indent2 << "return ret;\n"
|
||||||
<< Indent1 << "};\n\n};\n\n";
|
<< Indent1 << "};\n\n};\n\n";
|
||||||
|
Reference in New Issue
Block a user