Skip to content

Commit 0b96d22

Browse files
[SPIRV] Use StringRef instead of std::string (NFC) (#138408)
We can use StringRef for PassPrefix because it is used only with StringRef::starts_with.
1 parent b4fac94 commit 0b96d22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ namespace SPIRV {
184184
/// Parses the name part of the demangled builtin call.
185185
std::string lookupBuiltinNameHelper(StringRef DemangledCall,
186186
FPDecorationId *DecorationId) {
187-
const static std::string PassPrefix = "(anonymous namespace)::";
187+
StringRef PassPrefix = "(anonymous namespace)::";
188188
std::string BuiltinName;
189189
// Itanium Demangler result may have "(anonymous namespace)::" prefix
190-
if (DemangledCall.starts_with(PassPrefix.c_str()))
191-
BuiltinName = DemangledCall.substr(PassPrefix.length());
190+
if (DemangledCall.starts_with(PassPrefix))
191+
BuiltinName = DemangledCall.substr(PassPrefix.size());
192192
else
193193
BuiltinName = DemangledCall;
194194
// Extract the builtin function name and types of arguments from the call

0 commit comments

Comments
 (0)