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 "logical-location.h"
25 : :
26 : : /* A subclass of logical_location_manager in which the keys are
27 : : "tree".
28 : : Note that there is no integration with the garbage collector,
29 : : and so logical_location instances can only be short-lived. */
30 : 339496 : class tree_logical_location_manager : public logical_location_manager
31 : : {
32 : : public:
33 : : const char *get_short_name (key) const final override;
34 : : const char *get_name_with_scope (key) const final override;
35 : : const char *get_internal_name (key) const final override;
36 : : enum logical_location_kind get_kind (key) const final override;
37 : : label_text get_name_for_path_output (key) const final override;
38 : : key get_parent (key) const final override;
39 : :
40 : : static tree tree_from_key (logical_location k)
41 : : {
42 : 6667 : return const_cast<tree> (k.cast_to<const_tree> ());
43 : : }
44 : 103426 : static logical_location key_from_tree (tree node)
45 : : {
46 : 103351 : return logical_location::from_ptr (node);
47 : : }
48 : : };
49 : :
50 : : #endif /* GCC_TREE_LOGICAL_LOCATION_H. */
|