comparison ir/irstruct.h @ 142:a123dca8349b trunk

[svn r146] fixed some potential problems with mismatch in order of interfaces in class data layout
author lindquist
date Wed, 23 Jan 2008 15:48:19 +0100
parents ffcc9a2f3d9d
children aca17e55b7a5
comparison
equal deleted inserted replaced
141:8f43f5c43c95 142:a123dca8349b
40 40
41 Offset(VarDeclaration* v, const llvm::Type* ty) 41 Offset(VarDeclaration* v, const llvm::Type* ty)
42 : var(v), type(ty), init(NULL) {} 42 : var(v), type(ty), init(NULL) {}
43 }; 43 };
44 44
45 struct InterCmp
46 {
47 bool operator()(ClassDeclaration* lhs, ClassDeclaration* rhs) const
48 {
49 return strcmp(lhs->toPrettyChars(), rhs->toPrettyChars()) < 0;
50 }
51 };
52
53 typedef std::multimap<unsigned, Offset> OffsetMap; 45 typedef std::multimap<unsigned, Offset> OffsetMap;
54 typedef std::vector<VarDeclaration*> VarDeclVector; 46 typedef std::vector<VarDeclaration*> VarDeclVector;
55 typedef std::map<ClassDeclaration*, IrInterface*, InterCmp> InterfaceMap; 47 typedef std::map<ClassDeclaration*, IrInterface*> InterfaceMap;
56 typedef InterfaceMap::iterator InterfaceIter; 48 typedef InterfaceMap::iterator InterfaceMapIter;
49 typedef std::vector<IrInterface*> InterfaceVector;
50 typedef InterfaceVector::iterator InterfaceVectorIter;
57 51
58 public: 52 public:
59 IrStruct(Type*); 53 IrStruct(Type*);
60 virtual ~IrStruct(); 54 virtual ~IrStruct();
61 55
62 Type* type; 56 Type* type;
63 llvm::PATypeHolder recty; 57 llvm::PATypeHolder recty;
64 OffsetMap offsets; 58 OffsetMap offsets;
65 VarDeclVector defaultFields; 59 VarDeclVector defaultFields;
66 60
67 InterfaceMap interfaces; 61 InterfaceMap interfaceMap;
62 InterfaceVector interfaceVec;
68 const llvm::ArrayType* interfaceInfosTy; 63 const llvm::ArrayType* interfaceInfosTy;
69 llvm::GlobalVariable* interfaceInfos; 64 llvm::GlobalVariable* interfaceInfos;
70 65
71 bool defined; 66 bool defined;
72 bool constinited; 67 bool constinited;