Make it possible to test if the '-o' option is provided.
authorMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:24:07 +0000 (06:24 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:24:07 +0000 (06:24 +0000)
The following is now allowed:

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51751 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvmc2/AutoGenerated.cpp
utils/TableGen/LLVMCConfigurationEmitter.cpp

index 213db01e0bce48e6c3f0122cda771ce461ec2e88..30aeb8f75eae953cec375d4ed3fc861dff3af507 100644 (file)
@@ -29,5 +29,7 @@ namespace llvmc {
   extern const std::string& GetLanguage(const sys::Path& File);
 }
 
+extern cl::opt<std::string> OutputFilename;
+
 // The auto-generated file
 #include "AutoGenerated.inc"
index 45f6a13d2305bb16f9dba47adb193d695ea4805c..9be9cfc98b0a6ef7082698977a35a894d67d39b5 100644 (file)
@@ -691,11 +691,17 @@ bool EmitCaseTest1Arg(const std::string& TestName,
     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;