本文整理汇总了C++中StringRef::endswith_lower方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::endswith_lower方法的具体用法?C++ StringRef::endswith_lower怎么用?C++ StringRef::endswith_lower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringRef
的用法示例。
在下文中一共展示了StringRef::endswith_lower方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTargetDependentLibraryOption
llvm::SmallString<32> getTargetDependentLibraryOption(const llvm::Triple &T,
StringRef library) {
llvm::SmallString<32> buffer;
if (T.isWindowsMSVCEnvironment() || T.isWindowsItaniumEnvironment()) {
bool quote = library.find(' ') != StringRef::npos;
buffer += "/DEFAULTLIB:";
if (quote)
buffer += '"';
buffer += library;
if (!library.endswith_lower(".lib"))
buffer += ".lib";
if (quote)
buffer += '"';
} else if (T.isPS4()) {
bool quote = library.find(' ') != StringRef::npos;
buffer += "\01";
if (quote)
buffer += '"';
buffer += library;
if (quote)
buffer += '"';
} else {
buffer += "-l";
buffer += library;
}
return buffer;
}
示例2: Error
bool MSP430AsmParser::ParseInstruction(ParseInstructionInfo &Info,
StringRef Name, SMLoc NameLoc,
OperandVector &Operands) {
// Drop .w suffix
if (Name.endswith_lower(".w"))
Name = Name.drop_back(2);
if (!parseJccInstruction(Info, Name, NameLoc, Operands))
return false;
// First operand is instruction mnemonic
Operands.push_back(MSP430Operand::CreateToken(Name, NameLoc));
// If there are no more operands, then finish
if (getLexer().is(AsmToken::EndOfStatement))
return false;
// Parse first operand
if (ParseOperand(Operands))
return true;
// Parse second operand if any
if (getLexer().is(AsmToken::Comma)) {
getLexer().Lex(); // Eat ','
if (ParseOperand(Operands))
return true;
}
if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc();
getParser().eatToEndOfStatement();
return Error(Loc, "unexpected token");
}
getParser().Lex(); // Consume the EndOfStatement.
return false;
}
示例3: matchNameWordToTypeWord
/// Match a word within a name to a word within a type.
static bool matchNameWordToTypeWord(StringRef nameWord, StringRef typeWord) {
// If the name word is longer, there's no match.
if (nameWord.size() > typeWord.size()) return false;
// If the name word is shorter, try for a partial match.
if (nameWord.size() < typeWord.size()) {
// We can match the suffix of the type so long as everything preceding the
// match is neither a lowercase letter nor a '_'. This ignores type
// prefixes for acronyms, e.g., the 'NS' in 'NSURL'.
if (typeWord.endswith_lower(nameWord) &&
!clang::isLowercase(typeWord[typeWord.size()-nameWord.size()])) {
// Check that everything preceding the match is neither a lowercase letter
// nor a '_'.
for (unsigned i = 0, n = nameWord.size(); i != n; ++i) {
if (clang::isLowercase(typeWord[i]) || typeWord[i] == '_') return false;
}
return true;
}
// We can match a prefix so long as everything following the match is
// a number.
if (typeWord.startswith_lower(nameWord)) {
for (unsigned i = nameWord.size(), n = typeWord.size(); i != n; ++i) {
if (!clang::isDigit(typeWord[i])) return false;
}
return true;
}
return false;
}
// Check for an exact match.
return nameWord.equals_lower(typeWord);
}
示例4: isCOFFLibraryFileExtension
bool isCOFFLibraryFileExtension(StringRef path) {
return path.endswith_lower(".lib") || path.endswith_lower(".imp");
}
示例5: isAutorelease
static bool isAutorelease(const FunctionDecl *FD, StringRef FName) {
return FName.startswith_lower("autorelease") ||
FName.endswith_lower("autorelease");
}
示例6: isRetain
static bool isRetain(const FunctionDecl *FD, StringRef FName) {
return FName.startswith_lower("retain") || FName.endswith_lower("retain");
}