Author: maskray Date: Sat Dec 8 17:46:01 2018 New Revision: 348709 URL: http://llvm.org/viewvc/llvm-project?rev=348709&view=rev Log: SourceManager: insert(make_pair(..)) -> try_emplace. NFC
Modified: cfe/trunk/lib/Basic/SourceManager.cpp Modified: cfe/trunk/lib/Basic/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=348709&r1=348708&r2=348709&view=diff ============================================================================== --- cfe/trunk/lib/Basic/SourceManager.cpp (original) +++ cfe/trunk/lib/Basic/SourceManager.cpp Sat Dec 8 17:46:01 2018 @@ -195,8 +195,7 @@ llvm::MemoryBuffer *ContentCache::getBuf } 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( // 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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits