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


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

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


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

示例1: DEBUG

bool MipsOs16::runOnModule(Module &M) {
  bool usingMask = Mips32FunctionMask.length() > 0;
  bool doneUsingMask = false; // this will make it stop repeating
  DEBUG(dbgs() << "Run on Module MipsOs16 \n" << Mips32FunctionMask << "\n");
  if (usingMask)
    DEBUG(dbgs() << "using mask \n" << Mips32FunctionMask << "\n");
  unsigned int functionIndex = 0;
  bool modified = false;
  for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
    if (F->isDeclaration()) continue;
    DEBUG(dbgs() << "Working on " << F->getName() << "\n");
    if (usingMask) {
      if (!doneUsingMask) {
        if (functionIndex == Mips32FunctionMask.length())
          functionIndex = 0;
        switch (Mips32FunctionMask[functionIndex]) {
        case '1':
          DEBUG(dbgs() << "mask forced mips32: " << F->getName() << "\n");
          F->addFnAttr("nomips16");
          break;
        case '.':
          doneUsingMask = true;
          break;
        default:
          break;
        }
        functionIndex++;
      }
    }
    else {
      if (needsFP(*F)) {
        DEBUG(dbgs() << "os16 forced mips32: " << F->getName() << "\n");
        F->addFnAttr("nomips16");
      }
      else {
        DEBUG(dbgs() << "os16 forced mips16: " << F->getName() << "\n");
        F->addFnAttr("mips16");
      }
    }
  }
  return modified;
}
开发者ID:GameFusion,项目名称:llvm,代码行数:42,代码来源:MipsOs16.cpp

示例2: 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

示例3: getProgram

static std::string getProgram(const char *name, const cl::opt<std::string> &opt, const char *envVar = 0)
{
    std::string path;
    const char *prog = NULL;

    if (opt.getNumOccurrences() > 0 && opt.length() > 0 && (prog = opt.c_str()))
        path = findProgramByName(prog);

    if (path.empty() && envVar && (prog = getenv(envVar)))
        path = findProgramByName(prog);

    if (path.empty())
        path = findProgramByName(name);

    if (path.empty()) {
        error(Loc(), "failed to locate %s", name);
        fatal();
    }

    return path;
}
开发者ID:Geod24,项目名称:ldc,代码行数:21,代码来源:programs.cpp

示例4: getGcc

sys::Path getGcc() {
    const char *cc = NULL;
    
    if (gcc.getNumOccurrences() > 0 && gcc.length() > 0)
        cc = gcc.c_str();
    
    if (!cc)
        cc = getenv("CC");
    if (!cc)
        cc = "gcc";
    
    sys::Path path = sys::Program::FindProgramByName(cc);
    if (path.empty() && !cc) {
        if (cc) {
            path.set(cc);
        } else {
            error("failed to locate gcc");
            fatal();
        }
    }
    
    return path;
}
开发者ID:odis-project,项目名称:ldc,代码行数:23,代码来源:programs.cpp

示例5: getProgram

sys::Path getProgram(const char *name, const cl::opt<std::string> &opt, const char *envVar = 0)
{
    const char *prog = NULL;

    if (opt.getNumOccurrences() > 0 && opt.length() > 0)
        prog = gcc.c_str();

    if (!prog && envVar)
        prog = getenv(envVar);
    if (!prog)
        prog = name;

    sys::Path path = sys::Program::FindProgramByName(prog);
    if (path.empty() && !prog) {
        if (prog) {
            path.set(prog);
        } else {
            error("failed to locate %s", name);
            fatal();
        }
    }

    return path;
}
开发者ID:dansanduleac,项目名称:ldc,代码行数:24,代码来源:programs.cpp

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