[llvm-commits] [llvm] r51746 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Mikhail Glushenkov foldr at codedgers.com
Thu May 29 23:21:21 PDT 2008


Author: foldr
Date: Fri May 30 01:21:21 2008
New Revision: 51746

URL: http://llvm.org/viewvc/llvm-project?rev=51746&view=rev
Log:
Remove RequireDefault parameter from EmitCaseConstructHandler.

There are now no situations when 'default' is required.

Modified:
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=51746&r1=51745&r2=51746&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Fri May 30 01:21:21 2008
@@ -762,12 +762,11 @@
 // void F(Init* Statement, const char* IndentLevel, std::ostream& O).
 template <typename F>
 void EmitCaseConstructHandler(const DagInit* d, const char* IndentLevel,
-                              const F& Callback, bool DefaultRequired,
+                              const F& Callback,
                               const GlobalOptionDescriptions& OptDescs,
                               std::ostream& O) {
   assert(d->getOperator()->getAsString() == "case");
 
-  bool DefaultProvided = false;
   unsigned numArgs = d->getNumArgs();
   if (d->getNumArgs() < 2)
     throw "There should be at least one clause in the 'case' expression:\n"
@@ -778,7 +777,6 @@
 
     // Emit the test.
     if (Test.getOperator()->getAsString() == "default") {
-      DefaultProvided = true;
       if (i+2 != numArgs)
         throw std::string("The 'default' clause should be the last in the"
                           "'case' construct!");
@@ -799,10 +797,6 @@
     Callback(d->getArg(i), IndentLevel, O);
     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
@@ -1036,7 +1030,7 @@
   else
     EmitCaseConstructHandler(&InitPtrToDag(P.CmdLine), Indent2,
                              EmitCmdLineVecFillCallback(Version, P.Name),
-                             false, OptDescs, O);
+                             OptDescs, O);
 
   // For every understood option, emit handling code.
   for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
@@ -1337,7 +1331,7 @@
     << Indent2 << "unsigned ret = 0;\n";
 
   // Handle the 'case' construct.
-  EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O);
+  EmitCaseConstructHandler(Case, Indent2, IncDecWeight, OptDescs, O);
 
   O << Indent2 << "return ret;\n"
     << Indent1 << "};\n\n};\n\n";





More information about the llvm-commits mailing list