AsmParser: Save and restore the parsing state for types using SlotMapping.
[oota-llvm.git] / include / llvm / AsmParser / SlotMapping.h
1 //===-- SlotMapping.h - Slot number mapping for unnamed values --*- 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 contains the declaration of the SlotMapping struct.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_ASMPARSER_SLOTMAPPING_H
15 #define LLVM_ASMPARSER_SLOTMAPPING_H
16
17 #include "llvm/ADT/StringMap.h"
18 #include "llvm/IR/TrackingMDRef.h"
19 #include <map>
20 #include <vector>
21
22 namespace llvm {
23
24 class GlobalValue;
25 class Type;
26
27 /// This struct contains the mappings from the slot numbers to unnamed metadata
28 /// nodes, global values and types. It also contains the mapping for the named
29 /// types.
30 /// It can be used to save the parsing state of an LLVM IR module so that the
31 /// textual references to the values in the module can be parsed outside of the
32 /// module's source.
33 struct SlotMapping {
34   std::vector<GlobalValue *> GlobalValues;
35   std::map<unsigned, TrackingMDNodeRef> MetadataNodes;
36   StringMap<Type *> NamedTypes;
37   std::map<unsigned, Type *> Types;
38 };
39
40 } // end namespace llvm
41
42 #endif