From 6172f0298391e00cb669cc246e70ae2531f2cdec 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176004 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DIBuilder.h | 10 ++++++---- lib/IR/DIBuilder.cpp | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/llvm/DIBuilder.h b/include/llvm/DIBuilder.h index 5efbb9ef5b0..d59847558a1 100644 --- a/include/llvm/DIBuilder.h +++ b/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/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index bab30e4ef14..f31e531d47f 100644 --- a/lib/IR/DIBuilder.cpp +++ b/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.