[clang-tidy] Call StringMap::find without constructing std::string (NFC) (#115114)

StringMap::find takes StringRef, so we don't need to allocate
temporary instances of std::string.
This commit is contained in:
Kazu Hirata
2024-11-06 08:35:44 -08:00
committed by GitHub
parent b7ee03ffb8
commit c4dfa03f9f

View File

@@ -244,7 +244,7 @@ std::optional<DurationScale> getScaleForDurationInverse(llvm::StringRef Name) {
{"ToDoubleNanoseconds", DurationScale::Nanoseconds},
{"ToInt64Nanoseconds", DurationScale::Nanoseconds}});
auto ScaleIter = ScaleMap.find(std::string(Name));
auto ScaleIter = ScaleMap.find(Name);
if (ScaleIter == ScaleMap.end())
return std::nullopt;
@@ -260,7 +260,7 @@ std::optional<DurationScale> getScaleForTimeInverse(llvm::StringRef Name) {
{"ToUnixMicros", DurationScale::Microseconds},
{"ToUnixNanos", DurationScale::Nanoseconds}});
auto ScaleIter = ScaleMap.find(std::string(Name));
auto ScaleIter = ScaleMap.find(Name);
if (ScaleIter == ScaleMap.end())
return std::nullopt;