From cdd315198779293be5af29b201d3c303ad1ff230 Mon Sep 17 00:00:00 2001 From: Dylan Noblesmith Date: Sun, 24 Aug 2014 18:59:52 +0000 Subject: [PATCH] Frontend: unique_ptr-ify NFC. llvm-svn: 216347 --- clang/lib/Frontend/ASTUnit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index b39ba1b65a71..8101732f10c2 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -105,7 +105,8 @@ static llvm::sys::SmartMutex &getOnDiskMutex() { static void cleanupOnDiskMapAtExit(); -typedef llvm::DenseMap OnDiskDataMap; +typedef llvm::DenseMap> OnDiskDataMap; static OnDiskDataMap &getOnDiskDataMap() { static OnDiskDataMap M; static bool hasRegisteredAtExit = false; @@ -132,9 +133,9 @@ static OnDiskData &getOnDiskData(const ASTUnit *AU) { // DenseMap. llvm::MutexGuard Guard(getOnDiskMutex()); OnDiskDataMap &M = getOnDiskDataMap(); - OnDiskData *&D = M[AU]; + auto &D = M[AU]; if (!D) - D = new OnDiskData(); + D = llvm::make_unique(); return *D; } @@ -150,7 +151,6 @@ static void removeOnDiskEntry(const ASTUnit *AU) { OnDiskDataMap::iterator I = M.find(AU); if (I != M.end()) { I->second->Cleanup(); - delete I->second; M.erase(AU); } }