Skip to content

Commit 383a825

Browse files
[BOLT] Use StringRef::contains (NFC) (#139658)
Once we convert EventNames to StringRef, which is cheap, we can call StringRef::contains without creating a temporary instance of std::string.
1 parent 0fedccf commit 383a825

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
887887
}
888888

889889
bool YAMLProfileReader::usesEvent(StringRef Name) const {
890-
return YamlBP.Header.EventNames.find(std::string(Name)) != StringRef::npos;
890+
return StringRef(YamlBP.Header.EventNames).contains(Name);
891891
}
892892

893893
} // end namespace bolt

0 commit comments

Comments
 (0)