• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
18 namespace llvm {
19 namespace codeview {
20 
21 class MemoryTypeTableBuilder : public TypeTableBuilder {
22 public:
MemoryTypeTableBuilder()23   MemoryTypeTableBuilder() {}
24 
empty()25   bool empty() const { return Records.empty(); }
26 
ForEachRecord(TFunc Func)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 
36 protected:
37   TypeIndex writeRecord(llvm::StringRef Data) override;
38 
39 private:
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