diff options
Diffstat (limited to 'include/llvm/MC/StringTableBuilder.h')
-rw-r--r-- | include/llvm/MC/StringTableBuilder.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/MC/StringTableBuilder.h b/include/llvm/MC/StringTableBuilder.h index 065e9e0..897d449 100644 --- a/include/llvm/MC/StringTableBuilder.h +++ b/include/llvm/MC/StringTableBuilder.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_MC_STRINGTABLE_BUILDER_H -#define LLVM_MC_STRINGTABLE_BUILDER_H +#ifndef LLVM_MC_STRINGTABLEBUILDER_H +#define LLVM_MC_STRINGTABLEBUILDER_H #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" @@ -26,12 +26,18 @@ public: /// copy of s. Can only be used before the table is finalized. StringRef add(StringRef s) { assert(!isFinalized()); - return StringIndexMap.GetOrCreateValue(s, 0).getKey(); + return StringIndexMap.insert(std::make_pair(s, 0)).first->first(); } + enum Kind { + ELF, + WinCOFF, + MachO + }; + /// \brief Analyze the strings and build the final table. No more strings can /// be added after this point. - void finalize(); + void finalize(Kind kind); /// \brief Retrieve the string table data. Can only be used after the table /// is finalized. @@ -48,6 +54,8 @@ public: return StringIndexMap[s]; } + void clear(); + private: bool isFinalized() { return !StringTable.empty(); |