Skip to content

Commit b2e487d

Browse files
[llvm] Use StringRef::contains (NFC)
1 parent 2172eea commit b2e487d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ void AsmPrinter::emitPCSections(const MachineFunction &MF) {
15241524
const size_t OptStart = SecWithOpt.find('!'); // likely npos
15251525
const StringRef Sec = SecWithOpt.substr(0, OptStart);
15261526
const StringRef Opts = SecWithOpt.substr(OptStart); // likely empty
1527-
ConstULEB128 = Opts.find('C') != StringRef::npos;
1527+
ConstULEB128 = Opts.contains('C');
15281528
#ifndef NDEBUG
15291529
for (char O : Opts)
15301530
assert((O == '!' || O == 'C') && "Invalid !pcsections options");

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7488,7 +7488,7 @@ bool AArch64AsmParser::parseAuthExpr(const MCExpr *&Res, SMLoc &EndLoc) {
74887488
// Look for '_sym@AUTH' ...
74897489
if (Tok.is(AsmToken::Identifier) && Tok.getIdentifier().endswith("@AUTH")) {
74907490
StringRef SymName = Tok.getIdentifier().drop_back(strlen("@AUTH"));
7491-
if (SymName.find('@') != StringRef::npos)
7491+
if (SymName.contains('@'))
74927492
return TokError(
74937493
"combination of @AUTH with other modifiers not supported");
74947494
Res = MCSymbolRefExpr::create(Ctx.getOrCreateSymbol(SymName), Ctx);

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5565,7 +5565,7 @@ static AMDGPUNote getAMDGPUNote(uint32_t NoteType, ArrayRef<uint8_t> Desc) {
55655565
// FIXME: Metadata Verifier only works with AMDHSA.
55665566
// This is an ugly workaround to avoid the verifier for other MD
55675567
// formats (e.g. amdpal)
5568-
if (MsgPackString.find("amdhsa.") != StringRef::npos) {
5568+
if (MsgPackString.contains("amdhsa.")) {
55695569
AMDGPU::HSAMD::V3::MetadataVerifier Verifier(true);
55705570
if (!Verifier.verify(MsgPackDoc.getRoot()))
55715571
MetadataString = "Invalid AMDGPU Metadata\n";

llvm/unittests/MC/DwarfLineTableHeaders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ class DwarfLineTableHeaders : public ::testing::Test {
172172
Expected<StringRef> ContentsOrErr = Section.getContents();
173173
ASSERT_TRUE(static_cast<bool>(ContentsOrErr));
174174
StringRef Contents = *ContentsOrErr;
175-
ASSERT_TRUE(Contents.find("dir") != StringRef::npos);
176-
ASSERT_TRUE(Contents.find("file") != StringRef::npos);
175+
ASSERT_TRUE(Contents.contains("dir"));
176+
ASSERT_TRUE(Contents.contains("file"));
177177
ASSERT_TRUE(Contents.size() == 9);
178178
return;
179179
}

0 commit comments

Comments
 (0)