本文整理汇总了C++中llvm::StringRef::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::compare方法的具体用法?C++ StringRef::compare怎么用?C++ StringRef::compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::StringRef
的用法示例。
在下文中一共展示了StringRef::compare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//===----------------------------------------------------------------------===//
// parser<mcld::ZOption>
//===----------------------------------------------------------------------===//
bool parser<mcld::ZOption>::parse(llvm::cl::Option &O,
llvm::StringRef ArgName,
llvm::StringRef Arg,
mcld::ZOption &Val)
{
if (0 == Arg.compare("combreloc"))
Val.setKind(ZOption::CombReloc);
else if (0 == Arg.compare("nocombreloc"))
Val.setKind(ZOption::NoCombReloc);
else if (0 == Arg.compare("defs"))
Val.setKind(ZOption::Defs);
else if (0 == Arg.compare("execstack"))
Val.setKind(ZOption::ExecStack);
else if (0 == Arg.compare("noexecstack"))
Val.setKind(ZOption::NoExecStack);
else if (0 == Arg.compare("initfirst"))
Val.setKind(ZOption::InitFirst);
else if (0 == Arg.compare("interpose"))
Val.setKind(ZOption::InterPose);
else if (0 == Arg.compare("loadfltr"))
Val.setKind(ZOption::LoadFltr);
else if (0 == Arg.compare("muldefs"))
Val.setKind(ZOption::MulDefs);
else if (0 == Arg.compare("nocopyreloc"))
Val.setKind(ZOption::NoCopyReloc);
else if (0 == Arg.compare("nodefaultlib"))
Val.setKind(ZOption::NoDefaultLib);
else if (0 == Arg.compare("nodelete"))
Val.setKind(ZOption::NoDelete);
else if (0 == Arg.compare("nodlopen"))
Val.setKind(ZOption::NoDLOpen);
else if (0 == Arg.compare("nodump"))
Val.setKind(ZOption::NoDump);
else if (0 == Arg.compare("relro"))
Val.setKind(ZOption::Relro);
else if (0 == Arg.compare("norelro"))
Val.setKind(ZOption::NoRelro);
else if (0 == Arg.compare("lazy"))
Val.setKind(ZOption::Lazy);
else if (0 == Arg.compare("now"))
Val.setKind(ZOption::Now);
else if (0 == Arg.compare("origin"))
Val.setKind(ZOption::Origin);
else if (Arg.startswith("common-page-size=")) {
Val.setKind(ZOption::CommPageSize);
long long unsigned size = 0;
Arg.drop_front(17).getAsInteger(0, size);
Val.setPageSize(static_cast<uint64_t>(size));
} else if (Arg.startswith("max-page-size=")) {
Val.setKind(ZOption::MaxPageSize);
long long unsigned size = 0;
Arg.drop_front(14).getAsInteger(0, size);
Val.setPageSize(static_cast<uint64_t>(size));
}
if (ZOption::Unknown == Val.kind())
llvm::report_fatal_error(llvm::Twine("unknown -z option: `") +
Arg +
llvm::Twine("'\n"));
return false;
}