DIBuilder: take an optional StringRef to pass in unique identifier.

createClassType, createStructType, createUnionType, createEnumerationType,
and createForwardDecl will take an optional StringRef to pass in
the unique identifier.

llvm-svn: 189410
This commit is contained in:
Manman Ren 2013-08-27 23:06:40 +00:00
parent 63ffce2001
commit 547467b82d
2 changed files with 29 additions and 19 deletions

View File

@ -279,13 +279,15 @@ namespace llvm {
/// DW_AT_containing_type. See DWARF documentation
/// for more info.
/// @param TemplateParms Template type parameters.
/// @param UniqueIdentifier A unique identifier for the class.
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);
MDNode *TemplateParms = 0,
StringRef UniqueIdentifier = StringRef());
/// createStructType - Create debugging information entry for a struct.
/// @param Scope Scope in which this struct is defined.
@ -297,12 +299,14 @@ namespace llvm {
/// @param Flags Flags to encode member attribute, e.g. private
/// @param Elements Struct elements.
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
/// @param UniqueIdentifier A unique identifier for the struct.
DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
unsigned Flags, DIType DerivedFrom,
DIArray Elements, unsigned RunTimeLang = 0,
MDNode *VTableHolder = 0);
MDNode *VTableHolder = 0,
StringRef UniqueIdentifier = StringRef());
/// createUnionType - Create debugging information entry for an union.
/// @param Scope Scope in which this union is defined.
@ -314,10 +318,12 @@ namespace llvm {
/// @param Flags Flags to encode member attribute, e.g. private
/// @param Elements Union elements.
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
/// @param UniqueIdentifier A unique identifier for the union.
DICompositeType createUnionType(
DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
DIArray Elements, unsigned RunTimeLang = 0);
DIArray Elements, unsigned RunTimeLang = 0,
StringRef UniqueIdentifier = StringRef());
/// createTemplateTypeParameter - Create debugging information for template
/// type parameter.
@ -398,12 +404,11 @@ namespace llvm {
/// @param AlignInBits Member alignment.
/// @param Elements Enumeration elements.
/// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
/// @param UniqueIdentifier A unique identifier for the enum.
DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits,
uint64_t AlignInBits,
DIArray Elements,
DIType UnderlyingType);
DIFile File, unsigned LineNumber, uint64_t SizeInBits,
uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
StringRef UniqueIdentifier = StringRef());
/// createSubroutineType - Create subroutine type.
/// @param File File in which this subroutine is defined.
@ -423,7 +428,8 @@ namespace llvm {
DIDescriptor Scope, DIFile F,
unsigned Line, unsigned RuntimeLang = 0,
uint64_t SizeInBits = 0,
uint64_t AlignInBits = 0);
uint64_t AlignInBits = 0,
StringRef UniqueIdentifier = StringRef());
/// retainType - Retain DIType in a module even if it is not referenced
/// through debug info anchors.

View File

@ -599,7 +599,8 @@ DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
unsigned Flags, DIType DerivedFrom,
DIArray Elements,
MDNode *VTableHolder,
MDNode *TemplateParams) {
MDNode *TemplateParams,
StringRef UniqueIdentifier) {
assert((!Context || Context.isScope() || Context.isType()) &&
"createClassType should be called with a valid Context");
// TAG_class_type is encoded in DICompositeType format.
@ -618,7 +619,7 @@ DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
VTableHolder,
TemplateParams,
NULL // Type Identifer
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType R(MDNode::get(VMContext, Elts));
assert(R.isCompositeType() &&
@ -635,7 +636,8 @@ DICompositeType DIBuilder::createStructType(DIDescriptor Context,
unsigned Flags, DIType DerivedFrom,
DIArray Elements,
unsigned RunTimeLang,
MDNode *VTableHolder) {
MDNode *VTableHolder,
StringRef UniqueIdentifier) {
// TAG_structure_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_structure_type),
@ -652,7 +654,7 @@ DICompositeType DIBuilder::createStructType(DIDescriptor Context,
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
VTableHolder,
NULL,
NULL // Type Identifer
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType R(MDNode::get(VMContext, Elts));
assert(R.isCompositeType() &&
@ -666,7 +668,8 @@ DICompositeType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name,
uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Flags,
DIArray Elements,
unsigned RunTimeLang) {
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
// TAG_union_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_union_type),
@ -683,7 +686,7 @@ DICompositeType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name,
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
NULL,
NULL,
NULL // Type Identifer
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
};
return DICompositeType(MDNode::get(VMContext, Elts));
}
@ -717,7 +720,7 @@ DIBuilder::createSubroutineType(DIFile File, DIArray ParameterTypes) {
DICompositeType DIBuilder::createEnumerationType(
DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, DIArray Elements,
DIType UnderlyingType) {
DIType UnderlyingType, StringRef UniqueIdentifier) {
// TAG_enumeration_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
@ -734,7 +737,7 @@ DICompositeType DIBuilder::createEnumerationType(
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
NULL,
NULL // Type Identifer
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
};
MDNode *Node = MDNode::get(VMContext, Elts);
AllEnumTypes.push_back(Node);
@ -859,7 +862,8 @@ DICompositeType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
DIDescriptor Scope, DIFile F,
unsigned Line, unsigned RuntimeLang,
uint64_t SizeInBits,
uint64_t AlignInBits) {
uint64_t AlignInBits,
StringRef UniqueIdentifier) {
// Create a temporary MDNode.
Value *Elts[] = {
GetTagConstant(VMContext, Tag),
@ -877,7 +881,7 @@ DICompositeType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
NULL,
NULL, //TemplateParams
NULL // Type Identifer
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
};
MDNode *Node = MDNode::getTemporary(VMContext, Elts);
DICompositeType RetTy(Node);