llvmc: make switch options ZeroOrMore by default.
authorMikhail Glushenkov <foldr@codedgers.com>
Wed, 15 Dec 2010 01:21:59 +0000 (01:21 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Wed, 15 Dec 2010 01:21:59 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121822 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/LLVMCConfigurationEmitter.cpp

index d57d499ba9e9bd7929726e988cff9770b8365c26..c40a39dff729824674db75a5eb1d102c59aee2c6 100644 (file)
@@ -768,14 +768,21 @@ public:
 
     CheckNumberOfArguments(d, 2);
 
+    // Alias option store the aliased option name in the 'Help' field and do not
+    // have any properties.
     if (OD.isAlias()) {
-      // Aliases store the aliased option name in the 'Help' field.
       OD.Help = InitPtrToString(d.getArg(1));
     }
     else {
       processOptionProperties(d, OD);
     }
 
+    // Switch options are ZeroOrMore by default.
+    if (OD.isSwitch()) {
+      if (!(OD.isOptional() || OD.isOneOrMore() || OD.isRequired()))
+        OD.setZeroOrMore();
+    }
+
     OptDescs_.InsertDescription(OD);
   }