• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cl::opt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了opt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
    }
}
开发者ID:oclint,项目名称:oclint,代码行数:7,代码来源:Options.cpp


示例2: breakBeforeRunning

// Test the function and pass names we're given against the debug
// options that force us to break prior to a given pass and/or on a
// given function.
static bool breakBeforeRunning(StringRef fnName, StringRef passName) {
  if (SILBreakOnFun.empty() && SILBreakOnPass.empty())
    return false;

  if (SILBreakOnFun.empty() && passName == SILBreakOnPass)
    return true;

  if (SILBreakOnPass.empty() && fnName == SILBreakOnFun)
    return true;

  return fnName == SILBreakOnFun && passName == SILBreakOnPass;
}
开发者ID:0x4d4746h,项目名称:swift,代码行数:15,代码来源:PassManager.cpp


示例3: breakBeforeRunning

// Test the function and pass names we're given against the debug
// options that force us to break prior to a given pass and/or on a
// given function.
static bool breakBeforeRunning(StringRef fnName, SILFunctionTransform *SFT) {
  if (SILBreakOnFun.empty() && SILBreakOnPass.empty())
    return false;

  if (SILBreakOnFun.empty()
      && (SFT->getName() == SILBreakOnPass || SFT->getTag() == SILBreakOnPass))
    return true;

  if (SILBreakOnPass.empty() && fnName == SILBreakOnFun)
    return true;

  return fnName == SILBreakOnFun
    && (SFT->getName() == SILBreakOnPass || SFT->getTag() == SILBreakOnPass);
}
开发者ID:PiersonBro,项目名称:swift,代码行数:17,代码来源:PassManager.cpp


示例4: llvm_manager

// main function
int
main(int argc, char* argv[])
{
    llvm::llvm_shutdown_obj llvm_manager(false);

    cl::SetVersionPrinter(&PrintVersion);
    cl::ParseCommandLineOptions(argc, argv, "", true);

    // Handle special exiting options
    if (show_license)
    {
        for (std::size_t i=0; i<sizeof(license_msg)/sizeof(license_msg[0]); i++)
            llvm::outs() << license_msg[i] << '\n';
        return EXIT_SUCCESS;
    }

    DiagnosticOptions diag_opts;
    diag_opts.ShowOptionNames = 1;
    diag_opts.ShowSourceRanges = 1;
    TextDiagnosticPrinter diag_printer(llvm::errs(), diag_opts);
    IntrusiveRefCntPtr<DiagnosticIDs> diagids(new DiagnosticIDs);
    DiagnosticsEngine diags(diagids, &diag_printer, false);
    FileSystemOptions opts;
    FileManager file_mgr(opts);
    SourceManager source_mgr(diags, file_mgr);
    diags.setSourceManager(&source_mgr);
    diag_printer.setPrefix("ygas");

    for (std::vector<std::string>::const_iterator i=unknown_options.begin(),
         end=unknown_options.end(); i != end; ++i)
    {
        diags.Report(diag::warn_unknown_command_line_option) << *i;
    }

    // Load standard modules
    if (!LoadStandardPlugins())
    {
        diags.Report(diag::fatal_standard_modules);
        return EXIT_FAILURE;
    }

#ifndef BUILD_STATIC
    // Load plugins
    for (std::vector<std::string>::const_iterator i=plugin_names.begin(),
         end=plugin_names.end(); i != end; ++i)
    {
        if (!LoadPlugin(*i))
            diags.Report(diag::warn_plugin_load) << *i;
    }
#endif

    // Default to stdin if no filename specified.
    if (in_filename.empty())
        in_filename = "-";

    return do_assemble(source_mgr, diags);
}
开发者ID:8l,项目名称:yasm-nextgen,代码行数:58,代码来源:ygas.cpp


示例5: run

void SILPassManager::run() {
  const SILOptions &Options = getOptions();
  (void) Options;

  if (SILPrintAll) {
    if (SILPrintOnlyFun.empty() && SILPrintOnlyFuns.empty()) {
      llvm::dbgs() << "*** SIL module before transformation ("
                   << NumOptimizationIterations << ") ***\n";
      Mod->dump(Options.EmitVerboseSIL);
    } else {
      for (auto &F : *Mod) {
        if (!SILPrintOnlyFun.empty() && F.getName().str() == SILPrintOnlyFun) {
          llvm::dbgs() << "*** SIL function before transformation ("
                       << NumOptimizationIterations << ") ***\n";
          F.dump(Options.EmitVerboseSIL);
        }
        if (!SILPrintOnlyFuns.empty() &&
            F.getName().find(SILPrintOnlyFuns, 0) != StringRef::npos) {
          llvm::dbgs() << "*** SIL function before transformation ("
                       << NumOptimizationIterations << ") ***\n";
          F.dump(Options.EmitVerboseSIL);
        }
      }
    }
  }
  runOneIteration();
}
开发者ID:0x4d4746h,项目名称:swift,代码行数:27,代码来源:PassManager.cpp


示例6: main

int main(int argc, char **argv) {
   Galois::StatManager M;
   LonestarStart(argc, argv, name, desc, url);
   if(use_weighted_rmat)
      readWeightedRMAT(inputfile.c_str());
   else
      makeGraph(inputfile.c_str());
#if BORUVKA_DEBUG
   EdgeDataType kruskal_wt;
   if(verify_via_kruskal){
      kruskal_wt= verify(graph);
      cout<<"Kruskal MST Result is " << kruskal_wt <<"\n";
   }
#endif
   cout << "Starting loop body\n";
   EdgeDataType mst_wt = runBodyParallel();
   cout<<"Boruvka MST Result is " << mst_wt <<"\n";
#if BORUVKA_DEBUG
   if(verify_via_kruskal){
      assert(kruskal_wt==mst_wt);
   }
#endif

#if COMPILE_STATISICS
   cout<< " \n==================================================\n";
   stat_collector.dump(cout);
   cout<< " \n==================================================\n";
#endif
   return 0;
}
开发者ID:Surtr04,项目名称:UT_Internship,代码行数:30,代码来源:BoruvkaMerge.cpp


示例7: main

int main(int argc, char** argv)
{
    // Should ParseCommandLineOptions be able to accept a const argv?
    llvm::cl::ParseCommandLineOptions(argc, argv, "ploy compiler\n");

    const char* file_location = InputFile.c_str();

    symbol_table* tbl = sym_tbl = init_symbol_table();
    init_symbols(tbl);

    pointer ret = parse_file_to_tree(file_location, tbl);
    if(!ret)
        return 1;

    materialize_includes(&ret, tbl);

    ploy_do_compile(ret, tbl);
    type_map type_define_map;
    transform_tree_gen_typedef(ret, tbl, &type_define_map);
    transform_tree_gen_typeinfo(ret, tbl, &type_define_map);

    compiler* compile = init_compiler(tbl);

    compiler_compile_expression(compile, ret, EntryFunc.c_str());
    compiler_print_module(compile);
    compiler_write_asm_file(compile, OutputFile.c_str());

    destroy_compiler(compile);

    destroy_symbol_table(tbl);
    return 0;
}
开发者ID:Arelius,项目名称:ploy,代码行数:32,代码来源:driver.cpp


示例8: NumDebugFrontendAction

  NumDebugFrontendAction() {
#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 8
      std::error_code EC; 
      out = new llvm::raw_fd_ostream(output_file.c_str(), EC, 
              llvm::sys::fs::OpenFlags::F_None);
#else
      std::string code;
      out = new llvm::raw_fd_ostream(output_file.c_str(), code,
              llvm::sys::fs::OpenFlags::F_None);
#endif
  }
开发者ID:agrippa,项目名称:chimes,代码行数:11,代码来源:Driver.cpp


示例9: printModule

static void printModule(SILModule *Mod, bool EmitVerboseSIL) {
  if (SILPrintOnlyFun.empty() && SILPrintOnlyFuns.empty()) {
    Mod->dump();
    return;
  }
  for (auto &F : *Mod) {
    if (!SILPrintOnlyFun.empty() && F.getName().str() == SILPrintOnlyFun)
      F.dump(EmitVerboseSIL);

    if (!SILPrintOnlyFuns.empty() &&
        F.getName().find(SILPrintOnlyFuns, 0) != StringRef::npos)
      F.dump(EmitVerboseSIL);
  }
}
开发者ID:0x4d4746h,项目名称:swift,代码行数:14,代码来源:PassManager.cpp


示例10: main

int main(int argc, char** argv) {
  LonestarStart(argc, argv, name, desc, url);

	srand(-1);
	MetisGraph metisGraph;
	GGraph graph;
	metisGraph.setGraph(&graph);
	bool directed = true;
	if(mtxInput){
	  readMetisGraph(&metisGraph, filename.c_str());
	}else{
	  readGraph(&metisGraph, filename.c_str(), weighted, directed);
	}
	partition(&metisGraph, numPartitions);
	verify(&metisGraph);
}
开发者ID:nikunjy,项目名称:parallelStuff,代码行数:16,代码来源:GMetis.cpp


示例11: autoDetectFromDirectory

CompilationDatabase *autoDetectCompilations(std::string &ErrorMessage) {
  // Auto-detect a compilation database from BuildPath.
  if (BuildPath.getNumOccurrences() > 0)
    return CompilationDatabase::autoDetectFromDirectory(BuildPath,
                                                        ErrorMessage);
  // Try to auto-detect a compilation database from the first source.
  if (!SourcePaths.empty()) {
    if (CompilationDatabase *Compilations =
            CompilationDatabase::autoDetectFromSource(SourcePaths[0],
                                                      ErrorMessage)) {
      // FIXME: just pass SourcePaths[0] once getCompileCommands supports
      // non-absolute paths.
      SmallString<64> Path(SourcePaths[0]);
      llvm::sys::fs::make_absolute(Path);
      std::vector<CompileCommand> Commands =
          Compilations->getCompileCommands(Path);
      // Ignore a detected compilation database that doesn't contain source0
      // since it is probably an unrelated compilation database.
      if (!Commands.empty())
        return Compilations;
    }
    // Reset ErrorMessage since a fix compilation database will be created if
    // it fails to detect one from source.
    ErrorMessage = "";
    // If no compilation database can be detected from source then we create a
    // fixed compilation database with c++11 support.
    std::string CommandLine[] = { "-std=c++11" };
    return new FixedCompilationDatabase(".", CommandLine);
  }

  ErrorMessage = "Could not determine sources to transform";
  return 0;
}
开发者ID:zhongxingzhi,项目名称:clang-refactor,代码行数:33,代码来源:ClangModernize.cpp


示例12: main

int main(int argc, char** argv) {
  Galois::StatManager statManager;
  LonestarStart(argc, argv, name, desc, url);

  Galois::StatTimer Tinitial("InitializeTime");
  Tinitial.start();
  graph.structureFromFile(inputFilename.c_str());
  std::cout << "Num nodes: " << graph.size() << "\n";
  Tinitial.stop();

  //Galois::preAlloc(numThreads);
  Galois::Statistic("MeminfoPre", GaloisRuntime::MM::pageAllocInfo());
  switch (algo) {
    case demo: run<DemoAlgo>(); break;
    case asynchronous: run<AsynchronousAlgo>(); break;
    default: std::cerr << "Unknown algo: " << algo << "\n";
  }
  Galois::Statistic("MeminfoPost", GaloisRuntime::MM::pageAllocInfo());

  if (!skipVerify && !verify()) {
    std::cerr << "verification failed\n";
    assert(0 && "verification failed");
    abort();
  }

  return 0;
}
开发者ID:nikunjy,项目名称:parallelStuff,代码行数:27,代码来源:SpanningTree.cpp


示例13: LLVMTargetMachine

/// HSAILTargetMachine ctor -
///
HSAILTargetMachine::HSAILTargetMachine(const Target &T, StringRef TT,
    StringRef CPU, StringRef FS,const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,CodeGenOpt::Level OL, bool is64bitTarget )
:
  LLVMTargetMachine(T, TT, CPU, FS,Options, RM, CM,OL),
  Subtarget(TT, CPU, FS, is64bitTarget),
  //  DLInfo(Subtarget.getDataLayout()),
  FrameLowering(TargetFrameLowering::StackGrowsUp,
      Subtarget.getStackAlignment(), 0),
  //  InstrInfo(*this),
  //  TLInfo(*this), 
  IntrinsicInfo(this)
 {
     if (FileType == CGFT_AssemblyFile) {
       if (FileType.getNumOccurrences() == 0) {
         // LLVM's default is CGFT_AssemblyFile. HSAIL default is binary BRIG,
         // thus we need to change output to CGFT_AssemblyFile, unless text
         // assembly was explicitly requested by the command line switch.
         HSAILFileType = FileType = CGFT_ObjectFile;
       }
     }

     setAsmVerbosityDefault(true);

     // disable use of the .loc directive, because only by 
     // setting this to false does DwarfDebug generate the .debug_line
     // section
     //
     setMCUseLoc(false);

}
开发者ID:sagi1210,项目名称:HSAIL-HLC-Development,代码行数:32,代码来源:HSAILTargetMachine.cpp


示例14: output

int KoonDriver::output() const {
    Kompiler kompiler(OutputFilename);
    int res = kompiler.kompile(*this->_k.module());

    if (res) return res;
    std::string object = "/tmp/" + OutputFilename + ".o";

    Process("/usr/bin/ld",
            "--build-id",
            "--eh-frame-hdr",
            "--hash-style=gnu",
            "-m",
            "elf_x86_64",
            "-dynamic-linker",
            "/lib64/ld-linux-x86-64.so.2",
            "../krt/krt0.o",
//            "-L/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1",
            "-L/usr/lib",
            object.c_str(),
//            "-lgcc",
//            "--as-needed",
//            "-lgcc_s",
//            "--no-as-needed",
            "-lc",
            "-o",
            OutputFilename.c_str());

    Process("/usr/bin/rm", "-f", object.c_str());
    return res;
}
开发者ID:Mooris,项目名称:Koon,代码行数:30,代码来源:KoonDriver.cpp


示例15: viewCFG

void SILFunction::viewCFG() const {
/// When asserts are disabled, this should be a NoOp.
#ifndef NDEBUG
    // If we have a target function, only print that function out.
    if (!TargetFunction.empty() && !(getName().str() == TargetFunction))
      return;

  ViewGraph(const_cast<SILFunction *>(this), "cfg" + getName().str());
#endif
}
开发者ID:0x4d4746h,项目名称:swift,代码行数:10,代码来源:SILFunction.cpp


示例16: GetFileNameRoot

static llvm::tool_output_file *
GetOutputStream() {
 
    if (OutputFilename.empty()) {
        OutputFilename = GetFileNameRoot(InputFilename) + ".o";
    }
    
    string error;
    unsigned openFlags = llvm::raw_fd_ostream::F_Binary;
    llvm::tool_output_file * FDOut = new llvm::tool_output_file(OutputFilename.c_str(), error, openFlags);
    
    if (!error.empty()) {
        llvm::errs() << error << '\n';
        delete FDOut;
        return NULL;
    }
    
    return FDOut;
}
开发者ID:cobbal,项目名称:pietc,代码行数:19,代码来源:pietc.cpp


示例17: readInOutGraph

void readInOutGraph(Graph& graph) {
  using namespace Galois::Graph;
  if (symmetricGraph) {
    Galois::Graph::readGraph(graph, filename);
  } else if (transposeGraphName.size()) {
    Galois::Graph::readGraph(graph, filename, transposeGraphName);
  } else {
    GALOIS_DIE("Graph type not supported");
  }
}
开发者ID:Surtr04,项目名称:UT_Internship,代码行数:10,代码来源:BetweennessCentralityLigra.cpp


示例18: viewCFGHelper

static void viewCFGHelper(const SILFunction* f, bool skipBBContents) {
/// When asserts are disabled, this should be a NoOp.
#ifndef NDEBUG
    // If we have a target function, only print that function out.
    if (!TargetFunction.empty() && !(f->getName().str() == TargetFunction))
      return;

    ViewGraph(const_cast<SILFunction *>(f), "cfg" + f->getName().str(),
              /*shortNames=*/skipBBContents);
#endif
}
开发者ID:JoniusLi,项目名称:swift-1,代码行数:11,代码来源:SILFunction.cpp


示例19: 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;
}
开发者ID:sebastiankreutzer,项目名称:opovlint,代码行数:11,代码来源:main.cpp


示例20: main

int main(int argc, const char *argv[]) {
  llvm::cl::ParseCommandLineOptions(argc, argv);
  if (LogLevel < 0 || LogLevel > 3) {
    std::cerr << "Log level must be 0-3";
    return 1;
  }

  if (!DbFile.length())
    DbFile = "clscope.db";

  CrossReference CrossRef(DbFile);

  if (Query.length() > 0) {
    CrossRef.ListReferences(Query, QueryType, IdType);
  } else {
    // Index
    Index = new Indexer(Path, CrossRef);
    Index->Run();
  }
  return 0;
}
开发者ID:mjessome,项目名称:clang-scope,代码行数:21,代码来源:ClangScope.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ opt::ArgList类代码示例发布时间:2022-05-31
下一篇:
C++ cl::list类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap