summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-12-09 01:46:01 +0000
committerFangrui Song <maskray@google.com>2018-12-09 01:46:01 +0000
commiteae2b49fe3ddd13f85ae8da14676db42a7856aff (patch)
treefcd24b538ddeb3de43797aa45d169e7c912e3140 /clang/lib/Basic/SourceManager.cpp
parente3093808fb00e01bb1acae542f271f4c802e69b1 (diff)
downloadbcm5719-llvm-eae2b49fe3ddd13f85ae8da14676db42a7856aff.tar.gz
bcm5719-llvm-eae2b49fe3ddd13f85ae8da14676db42a7856aff.zip
SourceManager: insert(make_pair(..)) -> try_emplace. NFC
llvm-svn: 348709
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 6f35ecb5928..14c229c2a97 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -195,8 +195,7 @@ llvm::MemoryBuffer *ContentCache::getBuffer(DiagnosticsEngine &Diag,
}
unsigned LineTableInfo::getLineTableFilenameID(StringRef Name) {
- auto IterBool =
- FilenameIDs.insert(std::make_pair(Name, FilenamesByID.size()));
+ auto IterBool = FilenameIDs.try_emplace(Name, FilenamesByID.size());
if (IterBool.second)
FilenamesByID.push_back(&*IterBool.first);
return IterBool.first->second;
@@ -1965,9 +1964,7 @@ SourceManager::getDecomposedIncludedLoc(FileID FID) const {
// Uses IncludedLocMap to retrieve/cache the decomposed loc.
using DecompTy = std::pair<FileID, unsigned>;
- using MapTy = llvm::DenseMap<FileID, DecompTy>;
- std::pair<MapTy::iterator, bool>
- InsertOp = IncludedLocMap.insert(std::make_pair(FID, DecompTy()));
+ auto InsertOp = IncludedLocMap.try_emplace(FID);
DecompTy &DecompLoc = InsertOp.first->second;
if (!InsertOp.second)
return DecompLoc; // already in map.
OpenPOWER on IntegriCloud