Skip to content

Commit 61a286a

Browse files
[tools] Don't call StringRef::str() when calling StringMap::find (NFC) (#113119)
StringMap::find takes StringRef. We don't need to create an instance of std::string from StringRef only to convert it right back to StringRef.
1 parent 5c9c281 commit 61a286a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/tools/llvm-profdata/llvm-profdata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ adjustInstrProfile(std::unique_ptr<WriterContext> &WC,
12971297
} else {
12981298
auto NewName = StaticFuncMap.find(Name);
12991299
if (NewName != StaticFuncMap.end()) {
1300-
It = InstrProfileMap.find(NewName->second.str());
1300+
It = InstrProfileMap.find(NewName->second);
13011301
if (NewName->second != DuplicateNameStr) {
13021302
NewRootName = &NewName->second;
13031303
}
@@ -1382,7 +1382,7 @@ adjustInstrProfile(std::unique_ptr<WriterContext> &WC,
13821382
if (It == InstrProfileMap.end()) {
13831383
auto NewName = StaticFuncMap.find(Name);
13841384
if (NewName != StaticFuncMap.end()) {
1385-
It = InstrProfileMap.find(NewName->second.str());
1385+
It = InstrProfileMap.find(NewName->second);
13861386
if (NewName->second == DuplicateNameStr) {
13871387
WithColor::warning()
13881388
<< "Static function " << Name

llvm/tools/llvm-readtapi/llvm-readtapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static void stubifyDirectory(const StringRef InputPath, Context &Ctx) {
382382
// libraries to stubify.
383383
StringRef LibToCheck = Found->second;
384384
for (int i = 0; i < 20; ++i) {
385-
auto LinkIt = SymLinks.find(LibToCheck.str());
385+
auto LinkIt = SymLinks.find(LibToCheck);
386386
if (LinkIt != SymLinks.end()) {
387387
for (auto &SymInfo : LinkIt->second) {
388388
SmallString<PATH_MAX> LinkSrc(SymInfo.SrcPath);

0 commit comments

Comments
 (0)