1//===- MemoryTypeTableBuilder.h ---------------------------------*- 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#ifndef LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H 11#define LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H 12 13#include "llvm/ADT/DenseMap.h" 14#include "llvm/ADT/StringRef.h" 15#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h" 16#include <vector> 17 18namespace llvm { 19namespace codeview { 20 21class MemoryTypeTableBuilder : public TypeTableBuilder { 22public: 23 MemoryTypeTableBuilder() {} 24 25 bool empty() const { return Records.empty(); } 26 27 template <typename TFunc> void ForEachRecord(TFunc Func) { 28 uint32_t Index = TypeIndex::FirstNonSimpleIndex; 29 30 for (StringRef R : Records) { 31 Func(TypeIndex(Index), R); 32 ++Index; 33 } 34 } 35 36protected: 37 TypeIndex writeRecord(llvm::StringRef Data) override; 38 39private: 40 std::vector<StringRef> Records; 41 BumpPtrAllocator RecordStorage; 42 DenseMap<StringRef, TypeIndex> HashedRecords; 43}; 44 45} // end namespace codeview 46} // end namespace llvm 47 48#endif // LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H 49