From bbe0e1abe6215ede9824b337ae6cd2ce60685deb Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 25 Feb 2013 01:07:18 +0000 Subject: [PATCH] DIBuilder: support structs with vtable pointers in the same way as classes llvm-svn: 176004 --- llvm/include/llvm/DIBuilder.h | 10 ++++++---- llvm/lib/IR/DIBuilder.cpp | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/llvm/include/llvm/DIBuilder.h b/llvm/include/llvm/DIBuilder.h index 5efbb9e..d598475 100644 --- a/llvm/include/llvm/DIBuilder.h +++ b/llvm/include/llvm/DIBuilder.h @@ -282,10 +282,12 @@ namespace llvm { /// @param Flags Flags to encode member attribute, e.g. private /// @param Elements Struct elements. /// @param RunTimeLang Optional parameter, Objective-C runtime version. - DIType createStructType(DIDescriptor Scope, StringRef Name, DIFile File, - unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Flags, - DIArray Elements, unsigned RunTimeLang = 0); + 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); /// createUnionType - Create debugging information entry for an union. /// @param Scope Scope in which this union is defined. diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index bab30e4..f31e531 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -508,11 +508,15 @@ DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name, } /// createStructType - Create debugging information entry for a struct. -DIType DIBuilder::createStructType(DIDescriptor Context, StringRef Name, - DIFile File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, - unsigned Flags, DIArray Elements, - unsigned RunTimeLang) { +DICompositeType DIBuilder::createStructType(DIDescriptor Context, + StringRef Name, DIFile File, + unsigned LineNumber, + uint64_t SizeInBits, + uint64_t AlignInBits, + unsigned Flags, DIType DerivedFrom, + DIArray Elements, + unsigned RunTimeLang, + MDNode *VTableHolder) { // TAG_structure_type is encoded in DICompositeType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_structure_type), @@ -524,13 +528,13 @@ DIType DIBuilder::createStructType(DIDescriptor Context, StringRef Name, ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), ConstantInt::get(Type::getInt32Ty(VMContext), 0), ConstantInt::get(Type::getInt32Ty(VMContext), Flags), - NULL, + DerivedFrom, Elements, ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang), - NULL, + VTableHolder, NULL, }; - return DIType(MDNode::get(VMContext, Elts)); + return DICompositeType(MDNode::get(VMContext, Elts)); } /// createUnionType - Create debugging information entry for an union. -- 2.7.4