/// the SYS instruction. Parse them specially so that we create a SYS MCInst.
bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
OperandVector &Operands) {
- if (Name.find('.') != StringRef::npos)
+ if (Name.contains('.'))
return TokError("invalid operand");
Mnemonic = Name;
ValueKind MetadataStreamerV2::getValueKind(Type *Ty, StringRef TypeQual,
StringRef BaseTypeName) const {
- if (TypeQual.find("pipe") != StringRef::npos)
+ if (TypeQual.contains("pipe"))
return ValueKind::Pipe;
return StringSwitch<ValueKind>(BaseTypeName)
StringRef MetadataStreamerV3::getValueKind(Type *Ty, StringRef TypeQual,
StringRef BaseTypeName) const {
- if (TypeQual.find("pipe") != StringRef::npos)
+ if (TypeQual.contains("pipe"))
return "pipe";
return StringSwitch<StringRef>(BaseTypeName)
StringRef CPU = TM->getTargetCPU();
StringRef Features = TM->getTargetFeatureString();
if ((CPU.empty() || CPU.equals_insensitive("generic")) &&
- (Features.empty() ||
- Features.find_insensitive("wavefrontsize") == StringRef::npos))
+ (Features.empty() || !Features.contains_insensitive("wavefrontsize")))
return false;
Function *F = CI->getParent()->getParent();
FullFS += "+enable-prt-strict-null,"; // This is overridden by a disable in FS
// Disable mutually exclusive bits.
- if (FS.find_insensitive("+wavefrontsize") != StringRef::npos) {
- if (FS.find_insensitive("wavefrontsize16") == StringRef::npos)
+ if (FS.contains_insensitive("+wavefrontsize")) {
+ if (!FS.contains_insensitive("wavefrontsize16"))
FullFS += "-wavefrontsize16,";
- if (FS.find_insensitive("wavefrontsize32") == StringRef::npos)
+ if (!FS.contains_insensitive("wavefrontsize32"))
FullFS += "-wavefrontsize32,";
- if (FS.find_insensitive("wavefrontsize64") == StringRef::npos)
+ if (!FS.contains_insensitive("wavefrontsize64"))
FullFS += "-wavefrontsize64,";
}
return true;
// If either ".sdata." or ".sbss." is a substring of the section name
// then put the symbol in small data.
- return Sec.find(".sdata.") != StringRef::npos ||
- Sec.find(".sbss.") != StringRef::npos ||
- Sec.find(".scommon.") != StringRef::npos;
+ return Sec.contains(".sdata.") || Sec.contains(".sbss.") ||
+ Sec.contains(".scommon.");
}
static const char *getSectionSuffixForSize(unsigned Size) {
if (GO->hasSection()) {
StringRef Section = GO->getSection();
- if (Section.find(".access.text.group") != StringRef::npos)
+ if (Section.contains(".access.text.group"))
return getContext().getELFSection(GO->getSection(), ELF::SHT_PROGBITS,
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
- if (Section.find(".access.data.group") != StringRef::npos)
+ if (Section.contains(".access.data.group"))
return getContext().getELFSection(GO->getSection(), ELF::SHT_PROGBITS,
ELF::SHF_WRITE | ELF::SHF_ALLOC);
}
bool checkForP2AlignIfLoadStore(OperandVector &Operands, StringRef InstName) {
// FIXME: there is probably a cleaner way to do this.
- auto IsLoadStore = InstName.find(".load") != StringRef::npos ||
- InstName.find(".store") != StringRef::npos ||
- InstName.find("prefetch") != StringRef::npos;
- auto IsAtomic = InstName.find("atomic.") != StringRef::npos;
+ auto IsLoadStore = InstName.contains(".load") ||
+ InstName.contains(".store") ||
+ InstName.contains("prefetch");
+ auto IsAtomic = InstName.contains("atomic.");
if (IsLoadStore || IsAtomic) {
// Parse load/store operands of the form: offset:p2align=align
if (IsLoadStore && isNext(AsmToken::Colon)) {
// v128.{load,store}{8,16,32,64}_lane has both a memarg and a lane
// index. We need to avoid parsing an extra alignment operand for the
// lane index.
- auto IsLoadStoreLane = InstName.find("_lane") != StringRef::npos;
+ auto IsLoadStoreLane = InstName.contains("_lane");
if (IsLoadStoreLane && Operands.size() == 4)
return false;
// Alignment not specified (or atomics, must use default alignment).
// having a ".", such as a simple <Module>.<Function>.<Arity>, or an
// "_", such as the BIF "suspend_0") as they are executed on another
// stack.
- if (F->getName().find("erlang.") != StringRef::npos ||
- F->getName().find("bif_") != StringRef::npos ||
+ if (F->getName().contains("erlang.") || F->getName().contains("bif_") ||
F->getName().find_first_of("._") == StringRef::npos)
continue;
// Globals from llvm.metadata aren't emitted, do not instrument them.
if (Section == "llvm.metadata") return false;
// Do not instrument globals from special LLVM sections.
- if (Section.find("__llvm") != StringRef::npos || Section.find("__LLVM") != StringRef::npos) return false;
+ if (Section.contains("__llvm") || Section.contains("__LLVM"))
+ return false;
// Do not instrument function pointers to initialization and termination
// routines: dynamic linker will not properly handle redzones.
// printf("foo\n") --> puts("foo")
if (FormatStr.back() == '\n' &&
- FormatStr.find('%') == StringRef::npos) { // No format characters.
+ !FormatStr.contains('%')) { // No format characters.
// Create a string literal with no \n on it. We expect the constant merge
// pass to be run after this pass, to merge duplicate strings.
FormatStr = FormatStr.drop_back();
if (CI->arg_size() == 2) {
// Make sure there's no % in the constant array. We could try to handle
// %% -> % in the future if we cared.
- if (FormatStr.find('%') != StringRef::npos)
+ if (FormatStr.contains('%'))
return nullptr; // we found a format specifier, bail out.
// sprintf(str, fmt) -> llvm.memcpy(align 1 str, align 1 fmt, strlen(fmt)+1)
if (CI->arg_size() == 3) {
// Make sure there's no % in the constant array. We could try to handle
// %% -> % in the future if we cared.
- if (FormatStr.find('%') != StringRef::npos)
+ if (FormatStr.contains('%'))
return nullptr; // we found a format specifier, bail out.
if (N == 0)
// fprintf(F, "foo") --> fwrite("foo", 3, 1, F)
if (CI->arg_size() == 2) {
// Could handle %% -> % if we cared.
- if (FormatStr.find('%') != StringRef::npos)
+ if (FormatStr.contains('%'))
return nullptr; // We found a format specifier.
return emitFWrite(