Make DIBuilder::createClassType more type safe by returning DICompositeType rather than DIType

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-03-26 23:46:39 +00:00
parent f34ea642e6
commit ca442a4a1a
2 changed files with 17 additions and 14 deletions

View File

@ -265,12 +265,13 @@ namespace llvm {
/// DW_AT_containing_type. See DWARF documentation
/// for more info.
/// @param TemplateParms Template type parameters.
DIType createClassType(DIDescriptor Scope, StringRef Name, DIFile File,
unsigned LineNumber, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, DIType DerivedFrom,
DIArray Elements, MDNode *VTableHolder = 0,
MDNode *TemplateParms = 0);
DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
DIType DerivedFrom, DIArray Elements,
MDNode *VTableHolder = 0,
MDNode *TemplateParms = 0);
/// createStructType - Create debugging information entry for a struct.
/// @param Scope Scope in which this struct is defined.

View File

@ -482,13 +482,15 @@ DIBuilder::createTemplateValueParameter(DIDescriptor Context, StringRef Name,
}
/// createClassType - Create debugging information entry for a class.
DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
DIType DerivedFrom, DIArray Elements,
MDNode *VTableHolder,
MDNode *TemplateParams) {
DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint64_t OffsetInBits,
unsigned Flags, DIType DerivedFrom,
DIArray Elements,
MDNode *VTableHolder,
MDNode *TemplateParams) {
assert((!Context || Context.Verify()) &&
"createClassType should be called with a valid Context");
// TAG_class_type is encoded in DICompositeType format.
@ -508,7 +510,7 @@ DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
VTableHolder,
TemplateParams
};
DIType R(MDNode::get(VMContext, Elts));
DICompositeType R(MDNode::get(VMContext, Elts));
assert(R.Verify() && "createClassType should return a verifiable DIType");
return R;
}