From e894e09e704d760af47389c1a17927c8d848c2f8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 24 Mar 2012 18:22:12 +0000 Subject: [PATCH] Simplify some users of DenseMap::erase. llvm-svn: 153389 --- clang/lib/ARCMigrate/FileRemapper.cpp | 5 +---- clang/lib/CodeGen/CGDebugInfo.cpp | 5 +---- clang/lib/CodeGen/CodeGenModule.cpp | 5 +---- clang/lib/Lex/PreprocessingRecord.cpp | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp index 1e97c9eed523..474ce7dcbaf8 100644 --- a/clang/lib/ARCMigrate/FileRemapper.cpp +++ b/clang/lib/ARCMigrate/FileRemapper.cpp @@ -280,10 +280,7 @@ void FileRemapper::resetTarget(Target &targ) { delete oldmem; } else { const FileEntry *toFE = targ.get(); - llvm::DenseMap::iterator - I = ToFromMappings.find(toFE); - if (I != ToFromMappings.end()) - ToFromMappings.erase(I); + ToFromMappings.erase(toFE); } } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 1e0eeb2122e6..90eb861d939f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1235,10 +1235,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { } LexicalBlockStack.pop_back(); - llvm::DenseMap::iterator RI = - RegionMap.find(Ty->getDecl()); - if (RI != RegionMap.end()) - RegionMap.erase(RI); + RegionMap.erase(Ty->getDecl()); llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); // FIXME: Magic numbers ahoy! These should be changed when we diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5fdb427e27c9..1c8f5f65f93d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -823,10 +823,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { FD->getBody(InlineDefinition); StringRef MangledName = getMangledName(GD); - llvm::StringMap::iterator DDI = - DeferredDecls.find(MangledName); - if (DDI != DeferredDecls.end()) - DeferredDecls.erase(DDI); + DeferredDecls.erase(MangledName); EmitGlobalDefinition(InlineDefinition); return; } diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index b8e6152466ba..440e4780ca06 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -358,10 +358,7 @@ void PreprocessingRecord::MacroDefined(const Token &Id, void PreprocessingRecord::MacroUndefined(const Token &Id, const MacroInfo *MI) { - llvm::DenseMap::iterator Pos - = MacroDefinitions.find(MI); - if (Pos != MacroDefinitions.end()) - MacroDefinitions.erase(Pos); + MacroDefinitions.erase(MI); } void PreprocessingRecord::InclusionDirective(