]> granicus.if.org Git - clang/commitdiff
PR14763: Debug info for non-trivial record parameters
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 5 Jun 2013 18:30:31 +0000 (18:30 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 5 Jun 2013 18:30:31 +0000 (18:30 +0000)
There seems to have been some erroneous code attempting to describe the
ABI of parameters (non-trivial record parameters are passed by
reference). This would break the type of the function (especially when
it caused a mismatch between the type of a declaration & a definition)
causing PR14763 and PR14645.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183329 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info.cpp

index 80d5f101ee98df7bb468fbf0c5d2a39074841362..f90a609b4361ce3b4d227a21c815c2458e34f59f 100644 (file)
@@ -2570,22 +2570,6 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
   if (!Ty)
     return;
 
-  if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage)) {
-    // If Storage is an aggregate returned as 'sret' then let debugger know
-    // about this.
-    if (Arg->hasStructRetAttr())
-      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->hasNonTrivialCopyConstructor() ||
-          !Record->hasTrivialDestructor())
-        Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type,
-                                          Ty);
-    }
-  }
-
   // Get location information.
   unsigned Line = getLineNumber(VD->getLocation());
   unsigned Column = getColumnNumber(VD->getLocation());
index 4085b9ad3281467a8f85c5fefdd251408bfe9c9e..9413575b86cb5801ee3d127949882efd9bf0c272 100644 (file)
@@ -68,6 +68,20 @@ class Cls {
 Cls obj;
 }
 
+namespace pr14763 {
+struct foo {
+  foo(const foo&);
+};
+
+foo func(foo f) {
+  return f; // reference 'f' for now because otherwise we hit another bug
+}
+
+// CHECK: [[FUNC:![0-9]*]] = {{.*}} metadata !"_ZN7pr147634funcENS_3fooE", i32 {{[0-9]*}}, metadata [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
+// CHECK: [[PR14763:![0-9]*]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763]
+// CHECK: [[FOO:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763]], {{.*}} ; [ DW_TAG_structure_type ] [foo]
+}
+
 namespace pr9608 { // also pr9600
 struct incomplete;
 incomplete (*x)[3];
@@ -77,6 +91,9 @@ incomplete (*x)[3];
 // CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [fwd]
 }
 
+// For some reason the argument for PR14763 ended up all the way down here
+// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [f]
+
 namespace pr16214 {
 struct a {
   int i;