当前位置: 首页>>代码示例>>C++>>正文


C++ opt::substr方法代码示例

本文整理汇总了C++中cl::opt::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ opt::substr方法的具体用法?C++ opt::substr怎么用?C++ opt::substr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cl::opt的用法示例。


在下文中一共展示了opt::substr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: trim

CFG *Add_target(CFG *cfg,int target,string checkstr){
    check = trim(checkstr);
    CFG *cfg1=new CFG();
    cfg1=cfg;
    int len=check.length();
    char x[len];
    int numCheck=1;//count of equations
    for(int i=0;i<len;i++){
        x[i]=check.at(i);
        if(x[i]=='&')
            numCheck++;
    }
    State *old_target=cfg->searchState(target);
    string funcName = old_target->funcName;
    State *new_target=new State(false,-1,"q1",funcName);
    new_target->transList.clear();
    new_target->consList.clear();
    Transition *temp=new Transition(-2,"p1");
    temp->fromState=old_target;
    temp->fromName=cfg->getNodeName(target);
    temp->level=temp->fromState->level+1;
    temp->toState=new_target;
    new_target->level = temp->level;
    temp->toName="q1";
    temp->guardList.clear();
    int a[numCheck+1];
    int k=0;
    a[k++]=0;
    for(int i=0;i<len;i++)
        if(x[i]=='&')
            a[k++]=i+1;
    a[numCheck]=len+1;
    string b[numCheck];
    for(int i=0;i<numCheck;i++)
        b[i]=check.substr(a[i],a[i+1]-a[i]-1);

    Constraint cTemp;
    for(int i=0;i<numCheck;i++){
	cTemp = StringToConstraints(b[i], funcName);
	temp->guardList.push_back(cTemp);
    }

    cfg1->stateList.push_back(*new_target);
    cfg1->transitionList.push_back(*temp);
    return cfg1;
}
开发者ID:YichaoLee,项目名称:Checker,代码行数:46,代码来源:programCFG.cpp

示例2: main


//.........这里部分代码省略.........
    HierarchyBuilder checkHierarchy;
    checkHierarchy.computeHierarchy(module);
    if (eagerInline && checkHierarchy.isCyclic()) {
        std::cerr << "Cannot use \"-eager-inline\" with a cyclic call hierarchy!" << std::endl;
        return 7;
    }

    // transform!
    NondefFactory ndf(module);
    transformModule(module, function, ndf);

    // name them!
    InstNamer namer;
    namer.visit(module);

    // check them!
    const llvm::Type *boolType = llvm::Type::getInt1Ty(context);
    const llvm::Type *floatType = llvm::Type::getFloatTy(context);
    const llvm::Type *doubleType = llvm::Type::getDoubleTy(context);
    InstChecker checker(boolType, floatType, doubleType);
    checker.visit(module);

    // print it!
    if (debug) {
#if LLVM_VERSION < VERSION(3, 5)
        llvm::PassManager printPass;
        printPass.add(llvm::createPrintModulePass(&llvm::outs()));
        printPass.run(*module);
#else
        llvm::outs() << *module << '\n';
#endif
    }
    if (dumpLL) {
        std::string outFile = filename.substr(0, filename.length() - 3) + ".ll";
#if LLVM_VERSION < VERSION(3, 5)
        std::string errorInfo;
        llvm::raw_fd_ostream stream(outFile.data(), errorInfo);
        if (errorInfo.empty()) {
            llvm::PassManager dumpPass;
            dumpPass.add(llvm::createPrintModulePass(&stream));
            dumpPass.run(*module);
            stream.close();
        }
#elif LLVM_VERSION == VERSION(3, 5)
        std::string errorInfo;
        llvm::raw_fd_ostream stream(outFile.data(), errorInfo, llvm::sys::fs::F_Text);
        if (errorInfo.empty()) {
            stream << *module << '\n';
            stream.close();
        }
#else
        std::error_code errorCode;
        llvm::raw_fd_ostream stream(outFile.data(), errorCode, llvm::sys::fs::F_Text);
        if (!errorCode) {
            stream << *module << '\n';
            stream.close();
        }
#endif
    }

    // check for junk
    std::list<llvm::Instruction*> unsuitable = checker.getUnsuitableInsts();
    if (!unsuitable.empty()) {
        std::cerr << "Unsuitable instructions detected:" << std::endl;
        for (std::list<llvm::Instruction*>::iterator i = unsuitable.begin(), e = unsuitable.end(); i != e; ++i) {
            (*i)->dump();
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的cl::opt::substr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。