]> granicus.if.org Git - clang/commitdiff
Emit debug info for c++0x nullptr.
authorDevang Patel <dpatel@apple.com>
Wed, 14 Sep 2011 23:14:14 +0000 (23:14 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 14 Sep 2011 23:14:14 +0000 (23:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139752 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-char16.cpp
test/CodeGenCXX/debug-info-nullptr.cpp [new file with mode: 0644]

index 5061e2e8547c77b6cb400c13913a0599f879c547..919c5f9940a17adf4e5f968c9f4078743e1d20a4 100644 (file)
@@ -302,8 +302,8 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) {
     assert(0 && "Unexpected builtin type UnknownAny");
     return llvm::DIType();
   case BuiltinType::NullPtr:
-    assert(0 && "Unexpected builtin type NullPtr");
-    return llvm::DIType();
+    return DBuilder.
+      createNullPtrType(BT->getName(CGM.getContext().getLangOptions()));
   case BuiltinType::Void:
     return llvm::DIType();
   case BuiltinType::ObjCClass:
index d5bb43291cbbb6551564e79a8d3ea42d3f84fde3..3459b75776e3565add25ee53c12dc3d8f1454d33 100644 (file)
@@ -1,7 +1,8 @@
 // RUN: %clang_cc1 -S -std=c++0x -masm-verbose -g %s -o -| FileCheck %s
 
-//CHECK:       .byte   16
-//CHECK-NEXT:  .ascii   "char16_t"
+//CHECK:       .ascii   "char16_t"
+//CHECK-NEXT:  .byte   0
+//CHECK-NEXT:  .byte   16
 
 // 16 is DW_ATE_UTF (0x10) encoding attribute.
 char16_t char_a = u'h';
diff --git a/test/CodeGenCXX/debug-info-nullptr.cpp b/test/CodeGenCXX/debug-info-nullptr.cpp
new file mode 100644 (file)
index 0000000..3c6f316
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -std=c++0x -masm-verbose -g %s -o -| FileCheck %s
+
+//CHECK: DW_TAG_unspecified_type
+//CHECK-NEXT: "nullptr_t"
+
+void foo() {
+  decltype(nullptr) t = 0;
+ }