diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-11-19 05:49:42 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-11-19 05:49:42 +0000 |
| commit | 5106ce789771fafb4e3ea7faa2262fbf276753cd (patch) | |
| tree | e2fbf0655ed702ef925b52fc3f65cefdf9ec83a2 /llvm/tools/yaml2obj/yaml2elf.cpp | |
| parent | 1eb8220aff18a095c180efb0f44e452eeca5f643 (diff) | |
| download | bcm5719-llvm-5106ce789771fafb4e3ea7faa2262fbf276753cd.tar.gz bcm5719-llvm-5106ce789771fafb4e3ea7faa2262fbf276753cd.zip | |
Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)
Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.
llvm-svn: 222319
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2elf.cpp')
| -rw-r--r-- | llvm/tools/yaml2obj/yaml2elf.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp index 0b446c77c2f..44c8c12da89 100644 --- a/llvm/tools/yaml2obj/yaml2elf.cpp +++ b/llvm/tools/yaml2obj/yaml2elf.cpp @@ -62,11 +62,7 @@ class NameToIdxMap { public: /// \returns true if name is already present in the map. bool addName(StringRef Name, unsigned i) { - StringMapEntry<int> &Entry = Map.GetOrCreateValue(Name, -1); - if (Entry.getValue() != -1) - return true; - Entry.setValue((int)i); - return false; + return !Map.insert(std::make_pair(Name, (int)i)).second; } /// \returns true if name is not present in the map bool lookup(StringRef Name, unsigned &Idx) const { |

