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.

llvm-svn: 51751
This commit is contained in:
Mikhail Glushenkov 2008-05-30 06:24:07 +00:00
parent f83f33e8d3
commit bf14dd7dc3
2 changed files with 13 additions and 5 deletions

View 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"

View 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;