[cfe-commits] r157095 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info-rvalue-ref.cpp

Eric Christopher echristo at apple.com
Fri May 18 18:36:50 PDT 2012


Author: echristo
Date: Fri May 18 20:36:50 2012
New Revision: 157095

URL: http://llvm.org/viewvc/llvm-project?rev=157095&view=rev
Log:
Update API usage for llvm DIBuilder changes for rvalue reference
types and ensure we are actually creating the type.

rdar://11479676

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=157095&r1=157094&r2=157095&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri May 18 20:36:50 2012
@@ -576,8 +576,10 @@
                                                 const Type *Ty, 
                                                 QualType PointeeTy,
                                                 llvm::DIFile Unit) {
-  if (Tag == llvm::dwarf::DW_TAG_reference_type)
-    return DBuilder.createReferenceType(CreatePointeeType(PointeeTy, Unit));
+  if (Tag == llvm::dwarf::DW_TAG_reference_type ||
+      Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
+    return DBuilder.createReferenceType(Tag,
+                                        CreatePointeeType(PointeeTy, Unit));
                                     
   // Bit size, align and offset of the type.
   // Size is always the size of a pointer. We can't use getTypeSize here
@@ -2239,14 +2241,14 @@
     // If Storage is an aggregate returned as 'sret' then let debugger know
     // about this.
     if (Arg->hasStructRetAttr())
-      Ty = DBuilder.createReferenceType(Ty);
+      Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type, Ty);
     else if (CXXRecordDecl *Record = VD->getType()->getAsCXXRecordDecl()) {
       // If an aggregate variable has non trivial destructor or non trivial copy
       // constructor than it is pass indirectly. Let debug info know about this
       // by using reference of the aggregate type as a argument type.
       if (!Record->hasTrivialCopyConstructor() ||
           !Record->hasTrivialDestructor())
-        Ty = DBuilder.createReferenceType(Ty);
+        Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type, Ty);
     }
   }
       

Added: cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp?rev=157095&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp Fri May 18 20:36:50 2012
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
+
+extern "C" {
+extern int printf(const char * format, ...);
+}
+void foo (int &&i)
+{
+  printf("%d\n", i);
+}
+
+// CHECK: metadata !{i32 {{.*}}, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !10} ; [ DW_TAG_rvalue_reference_type ]





More information about the cfe-commits mailing list