Branch data Line data Source code
1 : : /* Subclass of logical_location_manager with knowledge of "tree".
2 : : Copyright (C) 2022-2025 Free Software Foundation, Inc.
3 : : Contributed by David Malcolm <dmalcolm@redhat.com>.
4 : :
5 : : This file is part of GCC.
6 : :
7 : : GCC is free software; you can redistribute it and/or modify it under
8 : : the terms of the GNU General Public License as published by the Free
9 : : Software Foundation; either version 3, or (at your option) any later
10 : : version.
11 : :
12 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 : : for more details.
16 : :
17 : : You should have received a copy of the GNU General Public License
18 : : along with GCC; see the file COPYING3. If not see
19 : : <http://www.gnu.org/licenses/>. */
20 : :
21 : : #ifndef GCC_TREE_LOGICAL_LOCATION_H
22 : : #define GCC_TREE_LOGICAL_LOCATION_H
23 : :
24 : : #include "diagnostics/logical-locations.h"
25 : :
26 : : /* A subclass of diagnostics::logical_locations::manager in which the
27 : : keys are "tree".
28 : : Note that there is no integration with the garbage collector,
29 : : and so key instances can only be short-lived. */
30 : 1200921 : class tree_logical_location_manager
31 : : : public diagnostics::logical_locations::manager
32 : : {
33 : : public:
34 : : using key = diagnostics::logical_locations::key;
35 : : using kind = diagnostics::logical_locations::kind;
36 : :
37 : : void dump (FILE *out, int indent) const final override;
38 : :
39 : : const char *get_short_name (key) const final override;
40 : : const char *get_name_with_scope (key) const final override;
41 : : const char *get_internal_name (key) const final override;
42 : : kind get_kind (key) const final override;
43 : : label_text get_name_for_path_output (key) const final override;
44 : : key get_parent (key) const final override;
45 : :
46 : : static tree tree_from_key (key k)
47 : : {
48 : 7137 : return const_cast<tree> (k.cast_to<const_tree> ());
49 : : }
50 : 105242 : static key key_from_tree (tree node)
51 : : {
52 : 105167 : return key::from_ptr (node);
53 : : }
54 : : };
55 : :
56 : : #endif /* GCC_TREE_LOGICAL_LOCATION_H. */
|