]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cgraphunit.c (assemble_thunk): Add source line info.
authorCary Coutant <ccoutant@google.com>
Mon, 6 Aug 2012 22:49:05 +0000 (22:49 +0000)
committerCary Coutant <ccoutant@gcc.gnu.org>
Mon, 6 Aug 2012 22:49:05 +0000 (15:49 -0700)
2012-08-06  Cary Coutant  <ccoutant@google.com>

gcc/
* cgraphunit.c (assemble_thunk): Add source line info.
* final.c (final): Check for non-null cfg pointer.

gcc/testsuite/
* g++.dg/debug/dwarf2/non-virtual-thunk.C: New test case.

From-SVN: r190190

gcc/ChangeLog
gcc/cgraphunit.c
gcc/final.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/non-virtual-thunk.C [new file with mode: 0644]

index 1aa0e5e01d65b8f55b921bf9885f6bb3ca1392cf..e87e0d4f091755218861112b65c41592bf3975f5 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-06  Cary Coutant  <ccoutant@google.com>
+
+       * cgraphunit.c (assemble_thunk): Add source line info.
+       * final.c (final): Check for non-null cfg pointer.
+
 2012-08-06  Sandra Loosemore  <sandra@codesourcery.com>
            Maxim Kuvyrkov  <maxim@codesourcery.com>
            Julian Brown  <julian@codesourcery.com>
index a6591b5c13314f5480b57525173d0d1a4bb26b9e..2dd0871e73681f15d68c8b5bc212454db068279b 100644 (file)
@@ -1381,6 +1381,10 @@ assemble_thunk (struct cgraph_node *node)
       init_function_start (thunk_fndecl);
       cfun->is_thunk = 1;
       assemble_start_function (thunk_fndecl, fnname);
+      (*debug_hooks->source_line) (DECL_SOURCE_LINE (thunk_fndecl),
+                                  DECL_SOURCE_FILE (thunk_fndecl),
+                                  /* discriminator */ 0,
+                                  /* is_stmt */ 1);
 
       targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
                                       fixed_offset, virtual_value, alias);
index cdae01173886cd3126e164d7eb17ecc122474270..30890b3ce223df7a918691583b9adf6b9515eef4 100644 (file)
@@ -1863,11 +1863,13 @@ final (rtx first, FILE *file, int optimize_p)
       start_to_bb = XCNEWVEC (basic_block, bb_map_size);
       end_to_bb = XCNEWVEC (basic_block, bb_map_size);
 
-      FOR_EACH_BB_REVERSE (bb)
-       {
-         start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
-         end_to_bb[INSN_UID (BB_END (bb))] = bb;
-       }
+      /* There is no cfg for a thunk.  */
+      if (!cfun->is_thunk)
+       FOR_EACH_BB_REVERSE (bb)
+         {
+           start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
+           end_to_bb[INSN_UID (BB_END (bb))] = bb;
+         }
     }
 
   /* Output the insns.  */
index 89a6917ce474f4ee4f6a96c123fdfead17bd83eb..5eeb52629eb83130c2a8436d414f61c28178ba4a 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-06  Cary Coutant  <ccoutant@google.com>
+
+       * g++.dg/debug/dwarf2/non-virtual-thunk.C: New test case.
+
 2012-08-06  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/35831
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/non-virtual-thunk.C b/gcc/testsuite/g++.dg/debug/dwarf2/non-virtual-thunk.C
new file mode 100644 (file)
index 0000000..8ad347a
--- /dev/null
@@ -0,0 +1,39 @@
+// { dg-do compile }
+// { dg-options "-g2 -dA" }
+
+// Verify that line number info is output for the non-virtual
+// thunks for C::~C().
+// { dg-final { scan-assembler "thunk.C:30" } }
+
+class A
+{
+ public:
+  A();
+  virtual ~A();
+ private:
+  int i;
+};
+
+class B
+{
+ public:
+  B();
+  virtual ~B();
+ private:
+  int i;
+};
+
+class C : public A, public B
+{
+ public:
+  C();
+  virtual ~C(); // line 30
+};
+
+C::C()
+{
+}
+
+C::~C()
+{
+}