PR debug/49951 - jumpy stepping at end of scope in C++
authorDodji Seketeli <dodji@redhat.com>
Tue, 20 Dec 2011 13:36:04 +0000 (13:36 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Tue, 20 Dec 2011 13:36:04 +0000 (14:36 +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: r182532

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

index 6fbd65219461adfa76de20650bb7fafbab76233b..0e570f82ed10ed7c8e4bdb5e10e63a277d57bdc4 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-20  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51612
index 0a43fb80cdcc06834366c1e2557294f0630f627e..2fc794b30ee7f99350804a7f903f7c6130d7f661 100644 (file)
@@ -13805,8 +13805,17 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
        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 f6eb1d1edad5e4c1011dec3d680f9dbee85c6fc7..0f947a944f02b7ab001314c24deeee9ba88b53e3 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-20  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51612
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) */
 }