diff options
| author | Eric Christopher <echristo@gmail.com> | 2013-01-16 01:22:23 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2013-01-16 01:22:23 +0000 |
| commit | 4d23a4ae1f426bcf420943ba14c0e2f382b1f303 (patch) | |
| tree | 3630d6dac3224fd837dbdd25dc7cbecc76c46564 /llvm/lib/IR | |
| parent | 2ccf3a291d5daf705595e333c438bdc8260df94e (diff) | |
| download | bcm5719-llvm-4d23a4ae1f426bcf420943ba14c0e2f382b1f303.tar.gz bcm5719-llvm-4d23a4ae1f426bcf420943ba14c0e2f382b1f303.zip | |
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!
llvm-svn: 172590
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 32 | ||||
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 2 |
2 files changed, 31 insertions, 3 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index bd7f0e3ffb9..0d106ace110 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/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); diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 7083495c72f..876aff85752 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -1101,6 +1101,8 @@ void DIType::printInternal(raw_ostream &OS) const { OS << " [fwd]"; if (isVector()) OS << " [vector]"; + if (isStaticMember()) + OS << " [static]"; } void DIDerivedType::printInternal(raw_ostream &OS) const { |

