1 //===- StringTableBuilder.h - PDB String Table Builder ----------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file creates the "/names" stream. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H 15 #define LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H 16 17 #include "llvm/ADT/DenseMap.h" 18 #include "llvm/ADT/StringRef.h" 19 #include "llvm/Support/Error.h" 20 #include <vector> 21 22 namespace llvm { 23 class BinaryStreamWriter; 24 25 namespace pdb { 26 27 class StringTableBuilder { 28 public: 29 // If string S does not exist in the string table, insert it. 30 // Returns the ID for S. 31 uint32_t insert(StringRef S); 32 33 uint32_t finalize(); 34 Error commit(BinaryStreamWriter &Writer) const; 35 36 private: 37 DenseMap<StringRef, uint32_t> Strings; 38 uint32_t StringSize = 1; 39 }; 40 41 } // end namespace pdb 42 } // end namespace llvm 43 44 #endif // LLVM_DEBUGINFO_PDB_RAW_STRINGTABLEBUILDER_H 45