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


C++ list::begin方法代码示例

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


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

示例1: main

int main(int argc, const char **argv) {
  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);

  CommonOptionsParser OptionsParser(argc, argv, ClangQueryCategory);

  if (!Commands.empty() && !CommandFiles.empty()) {
    llvm::errs() << argv[0] << ": cannot specify both -c and -f\n";
    return 1;
  }

  ClangTool Tool(OptionsParser.getCompilations(),
                 OptionsParser.getSourcePathList());
  std::vector<std::unique_ptr<ASTUnit>> ASTs;
  if (Tool.buildASTs(ASTs) != 0)
    return 1;

  QuerySession QS(ASTs);

  if (!Commands.empty()) {
    for (cl::list<std::string>::iterator I = Commands.begin(),
                                         E = Commands.end();
         I != E; ++I) {
      QueryRef Q = QueryParser::parse(*I, QS);
      if (!Q->run(llvm::outs(), QS))
        return 1;
    }
  } else if (!CommandFiles.empty()) {
    for (cl::list<std::string>::iterator I = CommandFiles.begin(),
                                         E = CommandFiles.end();
         I != E; ++I) {
      std::ifstream Input(I->c_str());
      if (!Input.is_open()) {
        llvm::errs() << argv[0] << ": cannot open " << *I << "\n";
        return 1;
      }
      while (Input.good()) {
        std::string Line;
        std::getline(Input, Line);

        QueryRef Q = QueryParser::parse(Line, QS);
        if (!Q->run(llvm::outs(), QS))
          return 1;
      }
    }
  } else {
    LineEditor LE("clang-query");
    LE.setListCompleter([&QS](StringRef Line, size_t Pos) {
      return QueryParser::complete(Line, Pos, QS);
    });
    while (llvm::Optional<std::string> Line = LE.readLine()) {
      QueryRef Q = QueryParser::parse(*Line, QS);
      Q->run(llvm::outs(), QS);
      llvm::outs().flush();
      if (QS.Terminate)
        break;
    }
  }

  return 0;
}
开发者ID:cierpuchaw,项目名称:clang-tools-extra,代码行数:60,代码来源:ClangQuery.cpp

示例2: BuildLinkItems

// BuildLinkItems -- This function generates a LinkItemList for the LinkItems
// linker function by combining the Files and Libraries in the order they were
// declared on the command line.
static void BuildLinkItems(
  Linker::ItemList& Items,
  const cl::list<std::string>& Files,
  const cl::list<std::string>& Libraries) {

  // Build the list of linkage items for LinkItems.

  cl::list<std::string>::const_iterator fileIt = Files.begin();
  cl::list<std::string>::const_iterator libIt  = Libraries.begin();

  int libPos = -1, filePos = -1;
  while ( libIt != Libraries.end() || fileIt != Files.end() ) {
    if (libIt != Libraries.end())
      libPos = Libraries.getPosition(libIt - Libraries.begin());
    else
      libPos = -1;
    if (fileIt != Files.end())
      filePos = Files.getPosition(fileIt - Files.begin());
    else
      filePos = -1;

    if (filePos != -1 && (libPos == -1 || filePos < libPos)) {
      // Add a source file
      Items.push_back(std::make_pair(*fileIt++, false));
    } else if (libPos != -1 && (filePos == -1 || libPos < filePos)) {
      // Add a library
      Items.push_back(std::make_pair(*libIt++, true));
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:33,代码来源:llvm-ld.cpp

示例3: ModulePass

InternalizePass::InternalizePass()
  : ModulePass(ID) {
  initializeInternalizePassPass(*PassRegistry::getPassRegistry());
  if (!APIFile.empty())           // If a filename is specified, use it.
    LoadFile(APIFile.c_str());
  ExternalNames.insert(APIList.begin(), APIList.end());
  DSONames.insert(DSOList.begin(), DSOList.end());
}
开发者ID:hephaex,项目名称:llvm,代码行数:8,代码来源:Internalize.cpp

示例4: output

    virtual bool
    runOnModule(Module& M)
    {
      AliasAnalysis& aa = this->getAnalysis<AliasAnalysis>();
      bool checked = false;

      errs() <<  "GatherInterfacePass::runOnModule: " << M.getModuleIdentifier() << "\n";
      
      if (!GatherInterfaceMain.empty()) {
        checked = true;
        for (cl::list<std::string>::const_iterator i = GatherInterfaceMain.begin(), e = GatherInterfaceMain.end();
            i != e; ++i) {
          Function* f = M.getFunction(*i);
          if (f == NULL) {
            errs() << "Function '" << *i << "' not found, skipping\n";
            continue;
          }
          if (f->isDeclaration()) {
            errs() << "Function '" << *i << "' is declaration, skipping\n";
            continue;
          }
          errs() << "Gathering from: " << *f << "\n";
          GatherInterface(*f, this->interface, &aa);
        }
      }
      if (!GatherInterfaceEntry.empty()) {
        checked = true;
        ComponentInterface ci;
        for (cl::list<std::string>::const_iterator i = GatherInterfaceEntry.begin(), e = GatherInterfaceEntry.end();
              i != e; ++i) {
          errs() << "Reading interface from '" << *i << "'...";
          if (ci.readFromFile(*i)) {
            errs() << "success\n";
          } else {
            errs() << "failed\n";
            continue;
          }
        }
        for (ComponentInterface::FunctionIterator i = ci.begin(), e = ci.end(); i != e; ++i) {
          Function* f = M.getFunction(i->first());
          if (f == NULL) continue;
          if (!GatherInterface(*f, this->interface, &aa)) break;
        }
      }
      if (!checked) {
        GatherInterface(M, this->interface, &aa);
      }

      if (GatherInterfaceOutput != "") {
        proto::ComponentInterface ci;
        codeInto<ComponentInterface, proto::ComponentInterface> (
            this->interface, ci);
        std::ofstream output(GatherInterfaceOutput.c_str(), std::ios::binary);
        assert(ci.SerializeToOstream(&output));
        output.close();
      }
      return false;
    }
开发者ID:SRI-CSL,项目名称:OCCAM,代码行数:58,代码来源:GatherInterface.cpp

示例5: BuildInitial

// Helper function used by Build().
// Traverses initial portions of the toolchains (up to the first Join node).
// This function is also responsible for handling the -x option.
void CompilationGraph::BuildInitial (InputLanguagesSet& InLangs,
                                     const sys::Path& TempDir) {
    // This is related to -x option handling.
    cl::list<std::string>::const_iterator xIter = Languages.begin(),
                                          xBegin = xIter, xEnd = Languages.end();
    bool xEmpty = true;
    const std::string* xLanguage = 0;
    unsigned xPos = 0, xPosNext = 0, filePos = 0;

    if (xIter != xEnd) {
        xEmpty = false;
        xPos = Languages.getPosition(xIter - xBegin);
        cl::list<std::string>::const_iterator xNext = llvm::next(xIter);
        xPosNext = (xNext == xEnd) ? std::numeric_limits<unsigned>::max()
                   : Languages.getPosition(xNext - xBegin);
        xLanguage = (*xIter == "none") ? 0 : &(*xIter);
    }

    // For each input file:
    for (cl::list<std::string>::const_iterator B = InputFilenames.begin(),
            CB = B, E = InputFilenames.end(); B != E; ++B) {
        sys::Path In = sys::Path(*B);

        // Code for handling the -x option.
        // Output: std::string* xLanguage (can be NULL).
        if (!xEmpty) {
            filePos = InputFilenames.getPosition(B - CB);

            if (xPos < filePos) {
                if (filePos < xPosNext) {
                    xLanguage = (*xIter == "none") ? 0 : &(*xIter);
                }
                else { // filePos >= xPosNext
                    // Skip xIters while filePos > xPosNext
                    while (filePos > xPosNext) {
                        ++xIter;
                        xPos = xPosNext;

                        cl::list<std::string>::const_iterator xNext = llvm::next(xIter);
                        if (xNext == xEnd)
                            xPosNext = std::numeric_limits<unsigned>::max();
                        else
                            xPosNext = Languages.getPosition(xNext - xBegin);
                        xLanguage = (*xIter == "none") ? 0 : &(*xIter);
                    }
                }
            }
        }

        // Find the toolchain corresponding to this file.
        const Node* N = FindToolChain(In, xLanguage, InLangs);
        // Pass file through the chain starting at head.
        PassThroughGraph(In, N, InLangs, TempDir);
    }
}
开发者ID:xjtunk,项目名称:llvm-power,代码行数:58,代码来源:CompilationGraph.cpp

示例6: main

int main(int argc, char **argv) {
  // Print a stack trace if we signal out.
  sys::PrintStackTraceOnErrorSignal();
  PrettyStackTraceProgram X(argc, argv);

  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
  cl::ParseCommandLineOptions(argc, argv, "llvm object size dumper\n");

  ToolName = argv[0];
  if (OutputFormatShort.getNumOccurrences())
    OutputFormat = OutputFormatShort;
  if (RadixShort.getNumOccurrences())
    Radix = RadixShort;

  if (InputFilenames.size() == 0)
    InputFilenames.push_back("a.out");

  if (OutputFormat == berkeley)
    outs() << "   text    data     bss     "
           << (Radix == octal ? "oct" : "dec")
           << "     hex filename\n";

  std::for_each(InputFilenames.begin(), InputFilenames.end(),
                PrintFileSectionSizes);

  return 0;
}
开发者ID:Xmister,项目名称:llvm-onex,代码行数:27,代码来源:llvm-size.cpp

示例7: main

int main(int argc, char **argv) {
  llvm::sys::PrintStackTraceOnErrorSignal();
  llvm::PrettyStackTraceProgram X(argc, argv);
  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
  cl::ParseCommandLineOptions(argc, argv,
                              "LLVM automatic testcase reducer. See\nhttp://"
                              "llvm.org/cmds/bugpoint.html"
                              " for more information.\n");
  sys::SetInterruptFunction(BugpointInterruptFunction);
  
  BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit);
  if (D.addSources(InputFilenames)) return 1;
  D.addPasses(PassList.begin(), PassList.end());

  // Bugpoint has the ability of generating a plethora of core files, so to
  // avoid filling up the disk, we prevent it
  sys::Process::PreventCoreFiles();

  try {
    return D.run();
  } catch (ToolExecutionError &TEE) {
    std::cerr << "Tool execution error: " << TEE.what() << '\n';
  } catch (const std::string& msg) {
    std::cerr << argv[0] << ": " << msg << "\n";
  } catch (...) {
    std::cerr << "Whoops, an exception leaked out of bugpoint.  "
              << "This is a bug in bugpoint!\n";
  }
  return 1;
}
开发者ID:aosm,项目名称:clang,代码行数:30,代码来源:bugpoint.cpp

示例8: runOnModule

bool DefineExtsPass::runOnModule(Module& M) {

  bool modified = false;

  for(cl::list<std::string>::iterator it = NullSymbols.begin(), it2 = NullSymbols.end(); it != it2; ++it) {

    GlobalValue* GV = M.getNamedValue(*it);
    if(!GV) {

      errs() << "Warning: skipped value " << *it << " (symbol not found)\n";
      continue;

    }
    
    if(Function* F = dyn_cast<Function>(GV)) {
      if(!F->isDeclaration()) {

	errs() << "Warning: skipped function " << *it << " because it has a definition\n";
	continue;

      }
    }

    GV->replaceAllUsesWith(Constant::getNullValue(GV->getType()));
    modified = true;

  }

  return modified;

}
开发者ID:smowton,项目名称:llpe,代码行数:31,代码来源:DefineExts.cpp

示例9: runOnModule

bool Preparer::runOnModule(Module &M) {
  IdentifyThreadFuncs &ITF = getAnalysis<IdentifyThreadFuncs>();

  for (cl::list<string>::const_iterator itr = OtherThreadFunctions.begin();
       itr != OtherThreadFunctions.end(); ++itr) {
    DEBUG(dbgs() << "Other thread functions: " << *itr << "\n";);
  }
开发者ID:wujingyue,项目名称:slicer,代码行数:7,代码来源:preparer.cpp

示例10: main

int main(int argc, char **argv) {
  // Print a stack trace if we signal out.
  sys::PrintStackTraceOnErrorSignal();
  PrettyStackTraceProgram X(argc, argv);

  llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
  cl::ParseCommandLineOptions(argc, argv, "llvm object size dumper\n");

  ToolName = argv[0];
  if (OutputFormatShort.getNumOccurrences())
    OutputFormat = OutputFormatShort;
  if (RadixShort.getNumOccurrences())
    Radix = RadixShort;

  for (unsigned i = 0; i < ArchFlags.size(); ++i) {
    if (ArchFlags[i] == "all") {
      ArchAll = true;
    } else {
      if (!MachOObjectFile::isValidArch(ArchFlags[i])) {
        outs() << ToolName << ": for the -arch option: Unknown architecture "
               << "named '" << ArchFlags[i] << "'";
        return 1;
      }
    }
  }

  if (InputFilenames.size() == 0)
    InputFilenames.push_back("a.out");

  moreThanOneFile = InputFilenames.size() > 1;
  std::for_each(InputFilenames.begin(), InputFilenames.end(),
                PrintFileSectionSizes);

  return 0;
}
开发者ID:SDkie,项目名称:llvm,代码行数:35,代码来源:llvm-size.cpp

示例11: EmitShellScript

/// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM
/// bytecode file for the program.
static void EmitShellScript(char **argv) {
  if (Verbose)
    cout << "Emitting Shell Script\n";
#if defined(_WIN32) || defined(__CYGWIN__)
  // Windows doesn't support #!/bin/sh style shell scripts in .exe files.  To
  // support windows systems, we copy the llvm-stub.exe executable from the
  // build tree to the destination file.
  std::string ErrMsg;  
  sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]);
  if (llvmstub.isEmpty())
    PrintAndExit("Could not find llvm-stub.exe executable!");

  if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg))
    PrintAndExit(ErrMsg);

  return;
#endif

  // Output the script to start the program...
  std::ofstream Out2(OutputFilename.c_str());
  if (!Out2.good())
    PrintAndExit("error opening '" + OutputFilename + "' for writing!");

  Out2 << "#!/bin/sh\n";
  // Allow user to setenv LLVMINTERP if lli is not in their PATH.
  Out2 << "lli=${LLVMINTERP-lli}\n";
  Out2 << "exec $lli \\\n";
  // gcc accepts -l<lib> and implicitly searches /lib and /usr/lib.
  LibPaths.push_back("/lib");
  LibPaths.push_back("/usr/lib");
  LibPaths.push_back("/usr/X11R6/lib");
  // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a
  // shared object at all! See RH 8: plain text.
  std::vector<std::string>::iterator libc =
    std::find(Libraries.begin(), Libraries.end(), "c");
  if (libc != Libraries.end()) Libraries.erase(libc);
  // List all the shared object (native) libraries this executable will need
  // on the command line, so that we don't have to do this manually!
  for (std::vector<std::string>::iterator i = Libraries.begin(),
         e = Libraries.end(); i != e; ++i) {
    sys::Path FullLibraryPath = sys::Path::FindLibrary(*i);
    if (!FullLibraryPath.isEmpty() && FullLibraryPath.isDynamicLibrary())
      Out2 << "    -load=" << FullLibraryPath.toString() << " \\\n";
  }
  Out2 << "    $0.bc ${1+\"[email protected]\"}\n";
  Out2.close();
}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:49,代码来源:llvm-ld.cpp

示例12: getRelPos

// getRelPos - Extract the member filename from the command line for
// the [relpos] argument associated with a, b, and i modifiers
void getRelPos() {
    if(RestOfArgs.size() > 0) {
        RelPos = RestOfArgs[0];
        RestOfArgs.erase(RestOfArgs.begin());
    }
    else
        throw "Expected [relpos] for a, b, or i modifier";
}
开发者ID:Celtoys,项目名称:clReflect,代码行数:10,代码来源:llvm-ar.cpp

示例13: is_specified_thread_function

bool Preparer::is_specified_thread_function(const Function *f) const {
  for (cl::list<string>::const_iterator itr = OtherThreadFunctions.begin();
       itr != OtherThreadFunctions.end(); ++itr) {
    if (f->getName() == *itr)
      return true;
  }
  return false;
}
开发者ID:wujingyue,项目名称:slicer,代码行数:8,代码来源:preparer.cpp

示例14: getArchive

// getArchive - Get the archive file name from the command line
void getArchive() {
    if(RestOfArgs.size() > 0) {
        ArchiveName = RestOfArgs[0];
        RestOfArgs.erase(RestOfArgs.begin());
    }
    else
        throw "An archive name must be specified.";
}
开发者ID:Celtoys,项目名称:clReflect,代码行数:9,代码来源:llvm-ar.cpp

示例15: ModulePass

InternalizePass::InternalizePass(bool AllButMain)
  : ModulePass(ID), AllButMain(AllButMain){
  initializeInternalizePassPass(*PassRegistry::getPassRegistry());
  if (!APIFile.empty())           // If a filename is specified, use it.
    LoadFile(APIFile.c_str());
  if (!APIList.empty())           // If a list is specified, use it as well.
    ExternalNames.insert(APIList.begin(), APIList.end());
}
开发者ID:bluemutedwisdom,项目名称:bhyve,代码行数:8,代码来源:Internalize.cpp


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