[lld] r243358 - Use SmallDenseMap instead of std::map where we don't care about order of keys.
Rui Ueyama
ruiu at google.com
Mon Jul 27 17:17:26 PDT 2015
Author: ruiu
Date: Mon Jul 27 19:17:25 2015
New Revision: 243358
URL: http://llvm.org/viewvc/llvm-project?rev=243358&view=rev
Log:
Use SmallDenseMap instead of std::map where we don't care about order of keys.
Modified:
lld/trunk/COFF/Writer.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=243358&r1=243357&r2=243358&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Mon Jul 27 19:17:25 2015
@@ -10,8 +10,9 @@
#include "Config.h"
#include "Writer.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileOutputBuffer.h"
@@ -195,7 +196,7 @@ void Writer::createSections() {
// '$' and all following characters in input section names are
// discarded when determining output section. So, .text$foo
// contributes to .text, for example. See PE/COFF spec 3.2.
- std::map<StringRef, OutputSection *> Sections;
+ SmallDenseMap<StringRef, OutputSection *> Sections;
for (auto Pair : Map) {
StringRef Name = getOutputSection(Pair.first);
OutputSection *&Sec = Sections[Name];
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=243358&r1=243357&r2=243358&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Jul 27 19:17:25 2015
@@ -10,7 +10,7 @@
#include "Writer.h"
#include "Chunks.h"
#include "Driver.h"
-#include <map>
+#include "llvm/ADT/DenseMap.h"
using namespace llvm;
using namespace llvm::ELF;
@@ -61,7 +61,7 @@ void OutputSection::addChunk(Chunk *C) {
// Create output section objects and add them to OutputSections.
template <class ELFT> void Writer<ELFT>::createSections() {
- std::map<StringRef, OutputSection *> Map;
+ SmallDenseMap<StringRef, OutputSection *> Map;
for (Chunk *C : Symtab->getChunks()) {
OutputSection *&Sec = Map[C->getSectionName()];
if (!Sec) {
More information about the llvm-commits
mailing list