[llvm-commits] [llvm] r51751 - in /llvm/trunk: tools/llvmc2/AutoGenerated.cpp utils/TableGen/LLVMCConfigurationEmitter.cpp

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


Author: foldr
Date: Fri May 30 01:24:07 2008
New Revision: 51751

URL: http://llvm.org/viewvc/llvm-project?rev=51751&view=rev
Log:
Make it possible to test if the '-o' option is provided.

The following is now allowed:

    (case (not_empty "o"), do_something, ...)

This didn't work previously because "-o" is built-in.

Modified:
    llvm/trunk/tools/llvmc2/AutoGenerated.cpp
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Modified: llvm/trunk/tools/llvmc2/AutoGenerated.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/AutoGenerated.cpp?rev=51751&r1=51750&r2=51751&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc2/AutoGenerated.cpp (original)
+++ llvm/trunk/tools/llvmc2/AutoGenerated.cpp Fri May 30 01:24:07 2008
@@ -29,5 +29,7 @@
   extern const std::string& GetLanguage(const sys::Path& File);
 }
 
+extern cl::opt<std::string> OutputFilename;
+
 // The auto-generated file
 #include "AutoGenerated.inc"

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

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Fri May 30 01:24:07 2008
@@ -691,11 +691,17 @@
     O << "GetLanguage(inFile) == \"" << OptName << '\"';
     return true;
   } else if (TestName == "not_empty") {
-    const GlobalOptionDescription& OptDesc = OptDescs.FindOption(OptName);
-    if (OptDesc.Type == OptionType::Switch)
-      throw OptName + ": incorrect option type!";
-    O << '!' << OptDesc.GenVariableName() << ".empty()";
-    return true;
+    if (OptName == "o") {
+      O << "!OutputFilename.empty()";
+      return true;
+    }
+    else {
+      const GlobalOptionDescription& OptDesc = OptDescs.FindOption(OptName);
+      if (OptDesc.Type == OptionType::Switch)
+        throw OptName + ": incorrect option type!";
+      O << '!' << OptDesc.GenVariableName() << ".empty()";
+      return true;
+    }
   }
 
   return false;





More information about the llvm-commits mailing list