diff options
Diffstat (limited to 'gcc/dumpfile.cc')
-rw-r--r-- | gcc/dumpfile.cc | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc index 65bd5c5..bca8b38 100644 --- a/gcc/dumpfile.cc +++ b/gcc/dumpfile.cc @@ -40,7 +40,6 @@ along with GCC; see the file COPYING3. If not see #include "optinfo-emit-json.h" #include "stringpool.h" /* for get_identifier. */ #include "spellcheck.h" -#include "make-unique.h" #include "pretty-print-format-impl.h" /* If non-NULL, return one past-the-end of the matching SUBPART of @@ -637,10 +636,10 @@ make_item_for_dump_gimple_stmt (gimple *stmt, int spc, dump_flags_t dump_flags) pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags); pp_newline (&pp); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE, - gimple_location (stmt), - xstrdup (pp_formatted_text (&pp))); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::gimple, + gimple_location (stmt), + xstrdup (pp_formatted_text (&pp))); return item; } @@ -685,10 +684,10 @@ make_item_for_dump_gimple_expr (gimple *stmt, int spc, dump_flags_t dump_flags) pp_needs_newline (&pp) = true; pp_gimple_stmt_1 (&pp, stmt, spc, dump_flags); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_GIMPLE, - gimple_location (stmt), - xstrdup (pp_formatted_text (&pp))); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::gimple, + gimple_location (stmt), + xstrdup (pp_formatted_text (&pp))); return item; } @@ -739,9 +738,9 @@ make_item_for_dump_generic_expr (tree node, dump_flags_t dump_flags) if (EXPR_HAS_LOCATION (node)) loc = EXPR_LOCATION (node); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TREE, loc, - xstrdup (pp_formatted_text (&pp))); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::tree, loc, + xstrdup (pp_formatted_text (&pp))); return item; } @@ -784,9 +783,9 @@ static std::unique_ptr<optinfo_item> make_item_for_dump_symtab_node (symtab_node *node) { location_t loc = DECL_SOURCE_LOCATION (node->decl); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_SYMTAB_NODE, loc, - xstrdup (node->dump_name ())); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::symtab_node, loc, + xstrdup (node->dump_name ())); return item; } @@ -847,7 +846,7 @@ dump_pretty_printer::stash_item (pp_token_list &formatted_tok_list, gcc_assert (item.get ()); auto custom_data - = ::make_unique<wrapped_optinfo_item> (std::move (item)); + = std::make_unique<wrapped_optinfo_item> (std::move (item)); formatted_tok_list.push_back<pp_token_custom_data> (std::move (custom_data)); } @@ -1012,9 +1011,10 @@ emit_any_pending_textual_chunks () return; char *formatted_text = xstrdup (pp_formatted_text (pp)); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - formatted_text); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::text, + UNKNOWN_LOCATION, + formatted_text); pp->emit_item (std::move (item), m_optinfo); /* Clear the pending text by unwinding formatted_text back to the start @@ -1085,8 +1085,9 @@ make_item_for_dump_dec (const poly_int<N, C> &value) } auto item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - xstrdup (pp_formatted_text (&pp))); + = std::make_unique<optinfo_item> (optinfo_item::kind::text, + UNKNOWN_LOCATION, + xstrdup (pp_formatted_text (&pp))); return item; } @@ -1163,9 +1164,10 @@ dump_context::begin_scope (const char *name, pretty_printer pp; pp_printf (&pp, "%s %s %s", "===", name, "==="); pp_newline (&pp); - std::unique_ptr<optinfo_item> item - = make_unique<optinfo_item> (OPTINFO_ITEM_KIND_TEXT, UNKNOWN_LOCATION, - xstrdup (pp_formatted_text (&pp))); + auto item + = std::make_unique<optinfo_item> (optinfo_item::kind::text, + UNKNOWN_LOCATION, + xstrdup (pp_formatted_text (&pp))); emit_item (*item.get (), MSG_NOTE); if (optinfo_enabled_p ()) @@ -1173,7 +1175,7 @@ dump_context::begin_scope (const char *name, optinfo &info = begin_next_optinfo (dump_metadata_t (MSG_NOTE, impl_location), user_location); - info.m_kind = OPTINFO_KIND_SCOPE; + info.m_kind = optinfo::kind::scope; info.add_item (std::move (item)); end_any_optinfo (); } @@ -1222,7 +1224,7 @@ dump_context::begin_next_optinfo (const dump_metadata_t &metadata, end_any_optinfo (); gcc_assert (m_pending == NULL); dump_location_t loc (user_loc, metadata.get_impl_location ()); - m_pending = new optinfo (loc, OPTINFO_KIND_NOTE, current_pass); + m_pending = new optinfo (loc, optinfo::kind::note, current_pass); m_pending->handle_dump_file_kind (metadata.get_dump_flags ()); return *m_pending; } @@ -2266,7 +2268,7 @@ verify_dumped_text (const location &loc, void verify_item (const location &loc, const optinfo_item *item, - enum optinfo_item_kind expected_kind, + enum optinfo_item::kind expected_kind, location_t expected_location, const char *expected_text) { @@ -2325,7 +2327,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 1); ASSERT_IS_TEXT (info->get_item (0), "int: 42 str: foo"); ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (), @@ -2346,7 +2348,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 2); ASSERT_IS_TEXT (info->get_item (0), "tree: "); ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0"); @@ -2368,7 +2370,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 2); ASSERT_IS_TEXT (info->get_item (0), "gimple: "); ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;"); @@ -2390,7 +2392,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 2); ASSERT_IS_TEXT (info->get_item (0), "gimple: "); ASSERT_IS_GIMPLE (info->get_item (1), stmt_loc, "return;\n"); @@ -2412,7 +2414,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 2); ASSERT_IS_TEXT (info->get_item (0), "node: "); ASSERT_IS_SYMTAB_NODE (info->get_item (1), decl_loc, "test_decl/1"); @@ -2442,7 +2444,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 8); ASSERT_IS_TEXT (info->get_item (0), "before "); ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0"); @@ -2472,7 +2474,7 @@ test_capture_of_dump_calls (const line_table_case &case_) optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); ASSERT_EQ (info->get_location_t (), stmt_loc); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 2); ASSERT_IS_TEXT (info->get_item (0), "test of tree: "); ASSERT_IS_TREE (info->get_item (1), UNKNOWN_LOCATION, "0"); @@ -2495,7 +2497,7 @@ test_capture_of_dump_calls (const line_table_case &case_) optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); ASSERT_EQ (info->get_location_t (), stmt_loc); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 1); ASSERT_IS_TREE (info->get_item (0), UNKNOWN_LOCATION, "1"); ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (), @@ -2599,7 +2601,7 @@ test_capture_of_dump_calls (const line_table_case &case_) { optinfo *info = tmp.get_pending_optinfo (); ASSERT_TRUE (info != NULL); - ASSERT_EQ (info->get_kind (), OPTINFO_KIND_NOTE); + ASSERT_EQ (info->get_kind (), optinfo::kind::note); ASSERT_EQ (info->num_items (), 1); ASSERT_IS_SYMTAB_NODE (info->get_item (0), decl_loc, "test_decl/1"); ASSERT_IMPL_LOCATION_EQ (info->get_impl_location (), @@ -2728,7 +2730,7 @@ test_capture_of_dump_calls (const line_table_case &case_) temp_dump_context tmp (true, true, MSG_ALL_KINDS); dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, "test"); ASSERT_EQ (tmp.get_pending_optinfo ()->get_kind (), - OPTINFO_KIND_SUCCESS); + optinfo::kind::success); } /* MSG_MISSED_OPTIMIZATION. */ @@ -2736,7 +2738,7 @@ test_capture_of_dump_calls (const line_table_case &case_) temp_dump_context tmp (true, true, MSG_ALL_KINDS); dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, "test"); ASSERT_EQ (tmp.get_pending_optinfo ()->get_kind (), - OPTINFO_KIND_FAILURE); + optinfo::kind::failure); } } |