本文整理汇总了C++中llvm::cl::opt::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ opt::getValue方法的具体用法?C++ opt::getValue怎么用?C++ opt::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::cl::opt
的用法示例。
在下文中一共展示了opt::getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char **argv) {
int success = 0;
if (argc > 1) {
clang::tooling::CommonOptionsParser OptionsParser(argc, argv, OpOvLintCategory);
OpOvApp app(Conf.getValue());
app.init();
success = app.execute(OptionsParser.getCompilations(), OptionsParser.getSourcePathList());
app.cleanUp();
}
return success;
}
示例2: VisitTestDefinition
// The test definition
void TestRunnerVisitor::VisitTestDefinition(TestDefinition *TD) {
TestResults results(mOrder);
results.mColumnNames = mColumnNames;
results.using_fork = !NoForkOpt.getValue();
string test_name = TestResults::getColumnString(TEST_NAME, TD);
results.mTmpFileName = test_name + "-tmp.txt";
pid_t pid;
if(NoForkOpt.getValue() == false) {
#ifdef __MINGW32__
cout << "Warning: Running test in same address space as jcut" << endl;
pid = 0;
#else
if(pipe(results.mPipe) == -1)
throw JCUTException("Could not create pipes for communication with the test "+test_name);
pid = fork();
#endif
if(pid == -1)
throw JCUTException("Could not fork process for test "+test_name);
}
else
pid = 0;
if(pid == 0) { // Child process will execute the test
if(TD->hasTestMockup()) {
vector<MockupFunction*> mockups=
TD->getTestMockup()->getMockupFixture()->getMockupFunctions();
for(MockupFunction* m : mockups) {
llvm::Function* change_to_mockup = m->getMockupFunction();
mEE->runFunction(change_to_mockup,mArgs);
}
}
runFunction(TD);
llvm::Function* func = TD->getLLVMResultFunction();
if(!func)
assert(false && "Function test result not found!");
llvm::GenericValue ret = mEE->runFunction(func, mArgs);
TD->setPassingValue(ret.IntVal.getBoolValue());
std::vector<ExpectedExpression*> failing;
// @bug @todo Debug ExpectedExpressions: Try all possible combinations.
// When the test does not have an expected result and the expected expression
// should fail, it always passess.
for(ExpectedExpression* ptr : mExpExpr) {
llvm::Function* ee_func = ptr->getLLVMResultFunction();
if(!ee_func)
assert(false && "Function expected result result not found!");
llvm::GenericValue ee_ret = mEE->runFunction(ee_func, mArgs);
bool passed = ee_ret.IntVal.getBoolValue();
if(passed == false)
failing.push_back(ptr);
TD->setPassingValue(passed);
}
mExpExpr.clear();
// Do the opposite steps for the Mockups
if(TD->hasTestMockup()) {
vector<MockupFunction*> mockups =
TD->getTestMockup()->getMockupFixture()->getMockupFunctions();
for(MockupFunction* m : mockups) {
llvm::Function* change_to_original = m->getOriginalFunction();
mEE->runFunction(change_to_original,mArgs);
}
////////////////////////////////////////////////
// Point to the mockup functions for the current group
executeMockupFunctionsOnTopOfStack();
}
// Include failing ExpectedExpressions from before and after statements.
if(!failing.empty())
TD->setFailedExpectedExpressions(failing);
results.collectTestResults(TD);
results.saveToDisk();
if(NoForkOpt.getValue() == false)
#ifdef __MINGW32__
do {} while(0); // @todo implement fork in windows
#else
_Exit(EXIT_SUCCESS);
#endif
} // end of child process
else { // Continue parent process
#ifdef __MINGW32__
do {} while(0); // @todo implement fork in windows
#else
int status = 0;
waitpid(pid, &status, 0);
if(WIFEXITED(status)) {
// Child process ended normally
} else {
stringstream ss;
string function_called = TD->getTestFunction()->
getFunctionCall()->getFunctionCalledString();
//.........这里部分代码省略.........