mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 06:40:01 +08:00
Use StringRef::contains (NFC)
This commit is contained in:
@@ -87,7 +87,7 @@ void CloexecCheck::insertStringFlag(
|
||||
|
||||
// Check if the <Mode> may be in the mode string.
|
||||
const auto *ModeStr = dyn_cast<StringLiteral>(ModeArg->IgnoreParenCasts());
|
||||
if (!ModeStr || (ModeStr->getString().find(Mode) != StringRef::npos))
|
||||
if (!ModeStr || ModeStr->getString().contains(Mode))
|
||||
return;
|
||||
|
||||
std::string ReplacementText = buildFixMsgForStringFlag(
|
||||
|
||||
@@ -64,7 +64,7 @@ static std::string collapseConsecutive(StringRef Str, char C) {
|
||||
static bool hasReservedDoubleUnderscore(StringRef Name,
|
||||
const LangOptions &LangOpts) {
|
||||
if (LangOpts.CPlusPlus)
|
||||
return Name.find("__") != StringRef::npos;
|
||||
return Name.contains("__");
|
||||
return Name.startswith("__");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ bool containsEscapes(StringRef HayStack, StringRef Escapes) {
|
||||
return false;
|
||||
|
||||
while (BackSlash != StringRef::npos) {
|
||||
if (Escapes.find(HayStack[BackSlash + 1]) == StringRef::npos)
|
||||
if (!Escapes.contains(HayStack[BackSlash + 1]))
|
||||
return false;
|
||||
BackSlash = HayStack.find('\\', BackSlash + 2);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ static SourceLocation findEndLocation(const Stmt &S, const SourceManager &SM,
|
||||
SourceRange TokRange(Loc, TokEndLoc);
|
||||
StringRef Comment = Lexer::getSourceText(
|
||||
CharSourceRange::getTokenRange(TokRange), SM, Context->getLangOpts());
|
||||
if (Comment.startswith("/*") && Comment.find('\n') != StringRef::npos) {
|
||||
if (Comment.startswith("/*") && Comment.contains('\n')) {
|
||||
// Multi-line block comment, insert brace before.
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
const char *Begin = SM.getCharacterData(Parm->getBeginLoc());
|
||||
const char *End = SM.getCharacterData(Parm->getLocation());
|
||||
StringRef Data(Begin, End - Begin);
|
||||
if (Data.find("/*") != StringRef::npos)
|
||||
if (Data.contains("/*"))
|
||||
continue;
|
||||
|
||||
UnnamedParams.push_back(std::make_pair(Function, I));
|
||||
|
||||
@@ -120,7 +120,7 @@ static void ApplyOneQAOverride(raw_ostream &OS,
|
||||
OS << "### Adding argument " << Str << " at end\n";
|
||||
Args.push_back(Str);
|
||||
} else if (Edit[0] == 's' && Edit[1] == '/' && Edit.endswith("/") &&
|
||||
Edit.slice(2, Edit.size()-1).find('/') != StringRef::npos) {
|
||||
Edit.slice(2, Edit.size() - 1).contains('/')) {
|
||||
StringRef MatchPattern = Edit.substr(2).split('/').first;
|
||||
StringRef ReplPattern = Edit.substr(2).split('/').second;
|
||||
ReplPattern = ReplPattern.slice(0, ReplPattern.size()-1);
|
||||
|
||||
@@ -565,7 +565,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
|
||||
// TODO: Use version number when setting target features
|
||||
// Currently LLVM supports only "mafdcbv".
|
||||
StringRef SupportedStandardExtension = "mafdcbv";
|
||||
if (SupportedStandardExtension.find(C) == StringRef::npos)
|
||||
if (!SupportedStandardExtension.contains(C))
|
||||
return createStringError(errc::invalid_argument,
|
||||
"unsupported standard user-level extension '%c'",
|
||||
C);
|
||||
|
||||
Reference in New Issue
Block a user