[SPIRV] Use StringRef instead of std::string (NFC) (#138408)
We can use StringRef for PassPrefix because it is used only with
StringRef::starts_with.
diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 78c0d25..c516be0 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -184,11 +184,11 @@
/// Parses the name part of the demangled builtin call.
std::string lookupBuiltinNameHelper(StringRef DemangledCall,
FPDecorationId *DecorationId) {
- const static std::string PassPrefix = "(anonymous namespace)::";
+ StringRef PassPrefix = "(anonymous namespace)::";
std::string BuiltinName;
// Itanium Demangler result may have "(anonymous namespace)::" prefix
- if (DemangledCall.starts_with(PassPrefix.c_str()))
- BuiltinName = DemangledCall.substr(PassPrefix.length());
+ if (DemangledCall.starts_with(PassPrefix))
+ BuiltinName = DemangledCall.substr(PassPrefix.size());
else
BuiltinName = DemangledCall;
// Extract the builtin function name and types of arguments from the call