本文整理汇总了C++中llvm::cl::opt::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ opt::setValue方法的具体用法?C++ opt::setValue怎么用?C++ opt::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::cl::opt
的用法示例。
在下文中一共展示了opt::setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateArgIfSet
void updateArgIfSet(llvm::cl::opt<T> &argValue, const llvm::Optional<T> &configValue)
{
if (configValue.hasValue() && argValue.getNumOccurrences() == 0)
{
argValue.setValue(configValue.getValue());
}
}
示例2: main
int main(int argc, char* argv[]) {
CodeHandler::Init(argc,argv);
// First check if the report file exists and if not create the table header
fstream report_file;
const char * report_file_name = (ReportFilename.size()) ? ReportFilename[0].c_str() : "report.out";
report_file.open(report_file_name,ios::in);
bool file_exists = report_file.is_open();
report_file.close();
report_file.open(report_file_name,ofstream::out | ofstream::app);
if ( !file_exists )
report_file << "| " << setw(15) << "Filename" << " | " <<
setw(10) << "Domain" << " | " <<
setw(12) << "CanonPoint" << " | " <<
setw(15) << "CanonStrategy" << " | " <<
setw(6) << "#Added" << " | " <<
setw(8) << "#Deleted" << " | " <<
setw(12) << "#DiffPoints" << " | " <<
setw(6) << "#Diffs" << " | " <<
setw(15) << "Optimal #Diffs" << "|\n";
report_file << "| "<< setw(15) << InputFilename <<
" | " << setw(10) << string(ManagerType[0]) <<
" | " << setw(12) << string((PartitionPoint.size() > 0) ? PartitionPoint[0] : "none") <<
" | " << setw(15) << string((PartitionStrategy.size() > 0) ? PartitionStrategy[0] : "equiv") <<
" | ";
string filename = InputFilename, patched_filname = PatchedFilename[0];
// Start by guarding both files
GuardFilename.addValue(filename);
cout << "GuardFilename = " << GuardFilename[0] << endl;
InputFilename = GuardFilename[0];
UnionCompiler().GuardedInstructionsTransform();
// Ignore this option from now own (the condition is size() == 1)
GuardFilename.addValue("");
GuardTaggedFilename.addValue(patched_filname);
cout << "GuardTaggedFilename = " << GuardTaggedFilename[0] << endl;
InputFilename = GuardTaggedFilename[0];
UnionCompiler().GuardedInstructionsTransform();
// Ignore this option from now own (the condition is size() == 1)
GuardTaggedFilename.addValue("");
// Now tag the patched file
TagFilename.addValue(Defines::kGuardedFilenamePrefix + patched_filname);
cout << "TagFilename = " << TagFilename[0] << endl;
InputFilename = TagFilename[0];
UnionCompiler().TagInstructionsTransform();
// Ignore this option from now own (the condition is size() == 1)
TagFilename.addValue("");
// Now union the files
InputFilename.setValue(Defines::kGuardedFilenamePrefix + filename);
PatchedFilename[0] = Defines::kTaggedFilenamePrefix + Defines::kGuardedFilenamePrefix + patched_filname;
cout << "InputFilename = " << InputFilename << ",PatchedFilename = " << PatchedFilename[0] << endl;
UnionCompiler().UnionTransform(report_file);
// Ignore this option from now own (the condition is size() == 1)
PatchedFilename.addValue("");
// Now analyze it
InputFilename.setValue(Defines::kUnionedFilenamePrefix + filename);
cout << "InputFilename = " << InputFilename << endl;
Analyzer().RunAnalysis(report_file);
report_file << setw(15) <<" |\n";
report_file.close();
return 0;
}