本文整理汇总了C++中StringRef::compare_lower方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::compare_lower方法的具体用法?C++ StringRef::compare_lower怎么用?C++ StringRef::compare_lower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringRef
的用法示例。
在下文中一共展示了StringRef::compare_lower方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runOnMachineFunction
bool DetectRoundChange::runOnMachineFunction(MachineFunction &MF) {
Subtarget = &MF.getSubtarget<SparcSubtarget>();
bool Modified = false;
for (auto MFI = MF.begin(), E = MF.end(); MFI != E; ++MFI) {
MachineBasicBlock &MBB = *MFI;
for (auto MBBI = MBB.begin(), E = MBB.end(); MBBI != E; ++MBBI) {
MachineInstr &MI = *MBBI;
unsigned Opcode = MI.getOpcode();
if (Opcode == SP::CALL && MI.getNumOperands() > 0) {
MachineOperand &MO = MI.getOperand(0);
if (MO.isGlobal()) {
StringRef FuncName = MO.getGlobal()->getName();
if (FuncName.compare_lower("fesetround") == 0) {
errs() << "Error: You are using the detectroundchange "
"option to detect rounding changes that will "
"cause LEON errata. The only way to fix this "
"is to remove the call to fesetround from "
"the source code.\n";
}
}
}
}
}
return Modified;
}
示例2: gsiRecordLess
// See `caseInsensitiveComparePchPchCchCch` in gsi.cpp
static bool gsiRecordLess(StringRef S1, StringRef S2) {
size_t LS = S1.size();
size_t RS = S2.size();
// Shorter strings always compare less than longer strings.
if (LS != RS)
return LS < RS;
// If either string contains non ascii characters, memcmp them.
if (LLVM_UNLIKELY(!isAsciiString(S1) || !isAsciiString(S2)))
return memcmp(S1.data(), S2.data(), LS) < 0;
// Both strings are ascii, perform a case-insenstive comparison.
return S1.compare_lower(S2.data()) < 0;
}
示例3: getOrderedName
bool clang::operator<(const CodeCompletionResult &X,
const CodeCompletionResult &Y) {
std::string XSaved, YSaved;
StringRef XStr = getOrderedName(X, XSaved);
StringRef YStr = getOrderedName(Y, YSaved);
int cmp = XStr.compare_lower(YStr);
if (cmp)
return cmp < 0;
// If case-insensitive comparison fails, try case-sensitive comparison.
cmp = XStr.compare(YStr);
if (cmp)
return cmp < 0;
return false;
}