]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR debug/49951 - jumpy stepping at end of scope in C++
authorDodji Seketeli <dodji@redhat.com>
Mon, 2 Jan 2012 17:08:48 +0000 (17:08 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Mon, 2 Jan 2012 17:08:48 +0000 (18:08 +0100)
gcc/cp/

PR debug/49951
* decl.c (cxx_maybe_build_cleanup): Don't set location of the call
to the destructor.

gcc/testsuite/

PR debug/49951
* g++.dg/gcov/gcov-2.C: Adjust.

From-SVN: r182808

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gcov/gcov-2.C

index 2f94d210c6dac2c53f5cce5963acf2d1af688311..7cdca29fd2c08f6576ba362fb65884187873bf9f 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-20  Dodji Seketeli  <dodji@redhat.com>
+
+       PR debug/49951
+       * decl.c (cxx_maybe_build_cleanup): Don't set location of the call
+       to the destructor.
+
 2011-12-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/51406
index d2e3d29615f1a53d8a0bd3e97bdd4e8b60b2b78d..c62a1ad2d24dd046c02fb11b97ab71a67c7d5790 100644 (file)
@@ -12877,8 +12877,17 @@ cxx_maybe_build_cleanup (tree decl)
        cleanup = call;
     }
 
+  /* build_delete sets the location of the destructor call to the
+     current location, even though the destructor is going to be
+     called later, at the end of the current scope.  This can lead to
+     a "jumpy" behaviour for users of debuggers when they step around
+     the end of the block.  So let's unset the location of the
+     destructor call instead.  */
+  if (cleanup != NULL && EXPR_P (cleanup))
+    SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
   return cleanup;
 }
+
 \f
 /* When a stmt has been parsed, this function is called.  */
 
index 8319732b01ee5e1d6f9cffa92cd92f6e8dc547c5..5ed1ab281c99d08674d112a4ee186e6cc8bf7035 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-20  Dodji Seketeli  <dodji@redhat.com>
+
+       PR debug/49951
+       * g++.dg/gcov/gcov-2.C: Adjust.
+
 2011-12-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/51406
index 6d002f5d2cd01d7818d14c45ae7092924d2fa8d8..66d8af39bce402032b6e5d60929e5980d34a272e 100644 (file)
@@ -20,7 +20,7 @@ private:
 
 void foo()
 {
-  C c;                                 /* count(2) */
+  C c;                                 /* count(1) */
   c.seti (1);                          /* count(1) */
 }