Author: Kazu Hirata Date: 2024-11-07T10:54:35-08:00 New Revision: c714f928b2f9ab3dd481f272a2aa72b83fd0562e
URL: https://github.com/llvm/llvm-project/commit/c714f928b2f9ab3dd481f272a2aa72b83fd0562e DIFF: https://github.com/llvm/llvm-project/commit/c714f928b2f9ab3dd481f272a2aa72b83fd0562e.diff LOG: [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. Added: Modified: clang/lib/InstallAPI/Frontend.cpp Removed: ################################################################################ diff --git a/clang/lib/InstallAPI/Frontend.cpp b/clang/lib/InstallAPI/Frontend.cpp index 2ebe72bf021cf9..9e8c60fbda3d00 100644 --- a/clang/lib/InstallAPI/Frontend.cpp +++ b/clang/lib/InstallAPI/Frontend.cpp @@ -94,7 +94,7 @@ InstallAPIContext::findAndRecordFile(const FileEntry *FE, // included. This is primarily to resolve headers found // in a diff erent location than what passed directly as input. StringRef IncludeName = PP.getHeaderSearchInfo().getIncludeNameForHeader(FE); - auto BackupIt = KnownIncludes.find(IncludeName.str()); + auto BackupIt = KnownIncludes.find(IncludeName); if (BackupIt != KnownIncludes.end()) { KnownFiles[FE] = BackupIt->second; return BackupIt->second; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits