summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DIBuilder.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-09-14 23:13:28 +0000
committerDevang Patel <dpatel@apple.com>2011-09-14 23:13:28 +0000
commit04d6d478650503e74d2f7e8337e6c2b381ba1bc7 (patch)
tree9c0f35d638ad0d3f967891c691b1bbaa747eaa21 /llvm/lib/Analysis/DIBuilder.cpp
parent21931efc4d1216267cc1aed156155d1a8d174956 (diff)
downloadbcm5719-llvm-04d6d478650503e74d2f7e8337e6c2b381ba1bc7.tar.gz
bcm5719-llvm-04d6d478650503e74d2f7e8337e6c2b381ba1bc7.zip
Add support to emit debug info for C++0x nullptr type.
llvm-svn: 139751
Diffstat (limited to 'llvm/lib/Analysis/DIBuilder.cpp')
-rw-r--r--llvm/lib/Analysis/DIBuilder.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DIBuilder.cpp b/llvm/lib/Analysis/DIBuilder.cpp
index cce8d968540..fd56d369a66 100644
--- a/llvm/lib/Analysis/DIBuilder.cpp
+++ b/llvm/lib/Analysis/DIBuilder.cpp
@@ -146,6 +146,26 @@ DIEnumerator DIBuilder::createEnumerator(StringRef Name, uint64_t Val) {
return DIEnumerator(MDNode::get(VMContext, Elts));
}
+/// createNullPtrType - Create C++0x nullptr type.
+DIType DIBuilder::createNullPtrType(StringRef Name) {
+ assert(!Name.empty() && "Unable to create type without name");
+ // nullptr is encoded in DIBasicType format. Line number, filename,
+ // ,size, alignment, offset and flags are always empty here.
+ Value *Elts[] = {
+ GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
+ NULL, //TheCU,
+ MDString::get(VMContext, Name),
+ NULL, // Filename
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
+ ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags;
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Encoding
+ };
+ return DIType(MDNode::get(VMContext, Elts));
+}
+
/// createBasicType - Create debugging information entry for a basic
/// type, e.g 'char'.
DIType DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
OpenPOWER on IntegriCloud