Skip to content

Commit c714f92

Browse files
authoredNov 7, 2024
[InstallAPI] Call DenseMap::find without constructing std::string (NFC) (#115260)
KnownIncludes is of DenseMap<StringRef, HeaderType>, so we don't need to allocate a temporary instance of std::string.
1 parent 7bd9be2 commit c714f92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎clang/lib/InstallAPI/Frontend.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ InstallAPIContext::findAndRecordFile(const FileEntry *FE,
9494
// included. This is primarily to resolve headers found
9595
// in a different location than what passed directly as input.
9696
StringRef IncludeName = PP.getHeaderSearchInfo().getIncludeNameForHeader(FE);
97-
auto BackupIt = KnownIncludes.find(IncludeName.str());
97+
auto BackupIt = KnownIncludes.find(IncludeName);
9898
if (BackupIt != KnownIncludes.end()) {
9999
KnownFiles[FE] = BackupIt->second;
100100
return BackupIt->second;

0 commit comments

Comments
 (0)