[llvm] c51c607 - [VirtualFileSystem] Use std::map::emplace
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 22 00:01:02 PDT 2023
Author: Fangrui Song
Date: 2023-07-22T00:00:57-07:00
New Revision: c51c607dfc6388050ed1381a32089cd08a36ff9a
URL: https://github.com/llvm/llvm-project/commit/c51c607dfc6388050ed1381a32089cd08a36ff9a
DIFF: https://github.com/llvm/llvm-project/commit/c51c607dfc6388050ed1381a32089cd08a36ff9a.diff
LOG: [VirtualFileSystem] Use std::map::emplace
Added:
Modified:
llvm/lib/Support/VirtualFileSystem.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index 25d057bd9c842c..d381d79fba9663 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -749,8 +749,7 @@ class InMemoryDirectory : public InMemoryNode {
}
InMemoryNode *addChild(StringRef Name, std::unique_ptr<InMemoryNode> Child) {
- return Entries.insert(make_pair(Name.str(), std::move(Child)))
- .first->second.get();
+ return Entries.emplace(Name, std::move(Child)).first->second.get();
}
using const_iterator = decltype(Entries)::const_iterator;
More information about the llvm-commits
mailing list