From 0fd7f9d7ffea48aa9c4965132ade33cf28f973ea Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 26 Jan 2010 21:14:59 +0000 Subject: [PATCH] Add extra element to composite type. This new element will be used to record c++ class that holds current class's vtable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94586 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DebugInfo.h | 6 +++++- lib/Analysis/DebugInfo.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 150d3ee8586..0227b2c6620 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -298,6 +298,9 @@ namespace llvm { DIArray getTypeArray() const { return getFieldAs(10); } unsigned getRunTimeLang() const { return getUnsignedField(11); } + DICompositeType getContainingType() const { + return getFieldAs(12); + } /// Verify - Verify that a composite type descriptor is well formed. bool Verify() const; @@ -567,7 +570,8 @@ namespace llvm { uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom, DIArray Elements, - unsigned RunTimeLang = 0); + unsigned RunTimeLang = 0, + MDNode *ContainingType = 0); /// CreateCompositeType - Create a composite type like array, struct, etc. DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context, diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 8bed36ee526..bff193d52ed 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -794,7 +794,8 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag, unsigned Flags, DIType DerivedFrom, DIArray Elements, - unsigned RuntimeLang) { + unsigned RuntimeLang, + MDNode *ContainingType) { Value *Elts[] = { GetTagConstant(Tag), @@ -808,9 +809,10 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag, ConstantInt::get(Type::getInt32Ty(VMContext), Flags), DerivedFrom.getNode(), Elements.getNode(), - ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang) + ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang), + ContainingType }; - return DICompositeType(MDNode::get(VMContext, &Elts[0], 12)); + return DICompositeType(MDNode::get(VMContext, &Elts[0], 13)); } -- 2.34.1