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

Mikhail Glushenkov foldr at codedgers.com
Wed Oct 21 21:15:08 PDT 2009


Author: foldr
Date: Wed Oct 21 23:15:07 2009
New Revision: 84827

URL: http://llvm.org/viewvc/llvm-project?rev=84827&view=rev
Log:
Make 'unset_option' work on list options.

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=84827&r1=84826&r2=84827&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Wed Oct 21 23:15:07 2009
@@ -2127,18 +2127,18 @@
   void onUnsetOption(Init* i, unsigned IndentLevel, raw_ostream& O) {
     const std::string& OptName = InitPtrToString(i);
     const OptionDescription& OptDesc = OptDescs_.FindOption(OptName);
-    const OptionType::OptionType OptType = OptDesc.Type;
 
-    if (OptType == OptionType::Switch) {
+    if (OptDesc.isSwitch()) {
       O.indent(IndentLevel) << OptDesc.GenVariableName() << " = false;\n";
     }
-    else if (OptType == OptionType::Parameter
-             || OptType == OptionType::Prefix) {
+    else if (OptDesc.isParameter()) {
       O.indent(IndentLevel) << OptDesc.GenVariableName() << " = \"\";\n";
     }
+    else if (OptDesc.isList()) {
+      O.indent(IndentLevel) << OptDesc.GenVariableName() << ".clear();\n";
+    }
     else {
-      throw std::string("'unset_option' can only be applied to "
-                        "switches or parameter/prefix options.");
+      throw "Can't apply 'unset_option' to alias option '" + OptName + "'";
     }
   }
 





More information about the llvm-commits mailing list