aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-01-16 01:22:23 +0000
committerEric Christopher <echristo@gmail.com>2013-01-16 01:22:23 +0000
commit6b6061f01171bd3d4e32022efa45428d4f9941ee (patch)
treeaae4e22e2a4ca079f2ff59c85f524318eb91d5a0 /lib/IR/DIBuilder.cpp
parent171192f149dce679cd520f85ffced4789448b017 (diff)
Define metadata interfaces for describing a static data member
of a class. Emit static data member declarations and definitions through correctly. Part of PR14471. Patch by Paul Robinson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DIBuilder.cpp')
-rw-r--r--lib/IR/DIBuilder.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index bd7f0e3ffb..0d106ace11 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -350,6 +350,30 @@ DIType DIBuilder::createMemberType(DIDescriptor Scope, StringRef Name,
return DIType(MDNode::get(VMContext, Elts));
}
+/// createStaticMemberType - Create debugging information entry for a
+/// C++ static data member.
+DIType DIBuilder::createStaticMemberType(DIDescriptor Scope, StringRef Name,
+ DIFile File, unsigned LineNumber,
+ DIType Ty, unsigned Flags,
+ llvm::Value *Val) {
+ // TAG_member is encoded in DIDerivedType format.
+ Flags |= DIDescriptor::FlagStaticMember;
+ Value *Elts[] = {
+ GetTagConstant(VMContext, dwarf::DW_TAG_member),
+ getNonCompileUnitScope(Scope),
+ MDString::get(VMContext, Name),
+ File,
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0/*SizeInBits*/),
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0/*AlignInBits*/),
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0/*OffsetInBits*/),
+ ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
+ Ty,
+ Val
+ };
+ return DIType(MDNode::get(VMContext, Elts));
+}
+
/// createObjCIVar - Create debugging information entry for Objective-C
/// instance variable.
DIType DIBuilder::createObjCIVar(StringRef Name,
@@ -787,7 +811,8 @@ createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber,
Ty,
ConstantInt::get(Type::getInt32Ty(VMContext), isLocalToUnit),
ConstantInt::get(Type::getInt32Ty(VMContext), 1), /* isDefinition*/
- Val
+ Val,
+ DIDescriptor()
};
MDNode *Node = MDNode::get(VMContext, Elts);
AllGVs.push_back(Node);
@@ -799,7 +824,7 @@ createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber,
DIGlobalVariable DIBuilder::
createStaticVariable(DIDescriptor Context, StringRef Name,
StringRef LinkageName, DIFile F, unsigned LineNumber,
- DIType Ty, bool isLocalToUnit, Value *Val) {
+ DIType Ty, bool isLocalToUnit, Value *Val, MDNode *Decl) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_variable),
Constant::getNullValue(Type::getInt32Ty(VMContext)),
@@ -812,7 +837,8 @@ createStaticVariable(DIDescriptor Context, StringRef Name,
Ty,
ConstantInt::get(Type::getInt32Ty(VMContext), isLocalToUnit),
ConstantInt::get(Type::getInt32Ty(VMContext), 1), /* isDefinition*/
- Val
+ Val,
+ DIDescriptor(Decl)
};
MDNode *Node = MDNode::get(VMContext, Elts);
AllGVs.push_back(Node);