use kill_instruction() when killing an OP_PHI during CSE
[smatch.git] / ast-view.c
blobc2b396307acdae650139710548c081d45b417ee6
2 #include <stdlib.h>
3 #include "ast-model.h"
4 #include "ast-inspect.h"
6 GtkWidget *
7 create_view_and_model (void *ptr)
9 GtkTreeViewColumn *text;
10 GtkCellRenderer *renderer;
11 AstNode *root;
12 GtkWidget *view;
14 root = ast_new(NULL, 0, "", ptr, inspect_symbol_list);
16 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(root));
18 g_object_unref(root); /* destroy store automatically with view */
20 renderer = gtk_cell_renderer_text_new();
21 text = gtk_tree_view_column_new_with_attributes("Node", renderer,
22 "text", AST_COL_NAME,
23 NULL);
24 gtk_tree_view_append_column(GTK_TREE_VIEW(view), text);
26 return view;
29 void
30 treeview_main (struct symbol_list *syms)
32 GtkWidget *window, *view, *scrollwin;
34 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
35 gtk_window_set_default_size (GTK_WINDOW(window), 600, 800);
36 g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
38 scrollwin = gtk_scrolled_window_new(NULL,NULL);
40 view = create_view_and_model(syms);
42 gtk_container_add(GTK_CONTAINER(scrollwin), view);
43 gtk_container_add(GTK_CONTAINER(window), scrollwin);
45 gtk_widget_show_all(window);
47 gtk_main();