+2018-09-21 David Malcolm <dmalcolm@redhat.com>
+
+ 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.
+
2018-09-21 Olivier Hainque <hainque@adacore.com>
* config.gcc: Factorize and comment inclusion of vxworks-dummy.h.
void
dump_context::begin_scope (const char *name, const dump_location_t &loc)
{
- if (dump_file)
+ if (dump_file && (MSG_NOTE & pflags))
::dump_loc (MSG_NOTE, dump_file, loc.get_location_t ());
- if (alt_dump_file)
+ if (alt_dump_file && (MSG_NOTE & alt_flags))
::dump_loc (MSG_NOTE, alt_dump_file, loc.get_location_t ());
/* Support for temp_dump_context in selftests. */
- if (m_test_pp)
+ if (m_test_pp && (MSG_NOTE & m_test_pp_flags))
::dump_loc (MSG_NOTE, m_test_pp, loc.get_location_t ());
pretty_printer pp;
OPTINFO_KIND_FAILURE);
}
}
+
+ /* Verify that MSG_* affect AUTO_DUMP_SCOPE and the dump calls. */
+ {
+ temp_dump_context tmp (false, MSG_OPTIMIZED_LOCATIONS);
+ dump_printf_loc (MSG_NOTE, stmt, "msg 1\n");
+ {
+ AUTO_DUMP_SCOPE ("outer scope", stmt);
+ dump_printf_loc (MSG_NOTE, stmt, "msg 2\n");
+ {
+ AUTO_DUMP_SCOPE ("middle scope", stmt);
+ dump_printf_loc (MSG_NOTE, stmt, "msg 3\n");
+ {
+ AUTO_DUMP_SCOPE ("inner scope", stmt);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, "msg 4\n");
+ }
+ dump_printf_loc (MSG_NOTE, stmt, "msg 5\n");
+ }
+ dump_printf_loc (MSG_NOTE, stmt, "msg 6\n");
+ }
+ dump_printf_loc (MSG_NOTE, stmt, "msg 7\n");
+
+ ASSERT_DUMPED_TEXT_EQ (tmp, "test.txt:5:10: note: msg 4\n");
+ }
}
/* Run all of the selftests within this file. */