dumpfile.c: fix stray dump_loc output (PR tree-optimization/87309)
commitcd35a24a71ca166b1d0a8003cd0cabeb51e1d225
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Sep 2018 14:17:07 +0000 (21 14:17 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Sep 2018 14:17:07 +0000 (21 14:17 +0000)
tree682109c0499e9a05bfc0d1b6f5b7ab53c634e5a2
parent85f370fe2a48909143e8a377c0fd64266b437f31
dumpfile.c: fix stray dump_loc output (PR tree-optimization/87309)

In r262891 I reimplemented this call:
  dump_printf_loc (MSG_NOTE, loc, "=== %s ===\n", name);
in dump_begin_scope to use direct calls to dump_loc:
  if (dump_file)
    {
      dump_loc (MSG_NOTE, dump_file, loc.get_location_t ());
      fprintf (dump_file, "=== %s ===\n", name);
    }

  if (alt_dump_file)
   {
     dump_loc (MSG_NOTE, alt_dump_file, loc.get_location_t ());
     fprintf (alt_dump_file, "=== %s ===\n", name);
   }

However ::dump_loc doesn't filter with pflags and alt_flags.

This lead to stray output of the form:
  test.cpp:1:6: note: test.cpp:1:11: note:
when using -fopt-info with "optimized" or "missed".

This patch adds this missing filtering, eliminating the stray partial
note output.

gcc/ChangeLog:
PR tree-optimization/87309
* dumpfile.c (dump_context::begin_scope): Filter the dump_loc
calls with pflags and alt_flags.
(selftest::test_capture_of_dump_calls): Add test of interaction of
MSG_OPTIMIZED_LOCATIONS with AUTO_DUMP_SCOPE.

gcc/testsuite/ChangeLog:
PR tree-optimization/87309
* gcc.dg/pr87309.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264481 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/dumpfile.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr87309.c [new file with mode: 0644]