blob: c14a28282dabe3fd88791d5c867f6c4cc8e79e93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/* Concrete subclass of logical_locations::manager for use in selftests.
Copyright (C) 2024-2025 Free Software Foundation, Inc.
Contributed by David Malcolm <dmalcolm@redhat.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_DIAGNOSTICS_SELFTEST_LOGICAL_LOCATIONS_H
#define GCC_DIAGNOSTICS_SELFTEST_LOGICAL_LOCATIONS_H
#include "diagnostics/logical-locations.h"
/* The selftest code should entirely disappear in a production
configuration, hence we guard all of it with #if CHECKING_P. */
#if CHECKING_P
namespace diagnostics {
namespace logical_locations {
namespace selftest {
/* Concrete subclass of logical_locations::manager for use in selftests. */
class test_manager : public manager
{
public:
~test_manager ();
const char *get_short_name (key) const final override;
const char *get_name_with_scope (key) const final override;
const char *get_internal_name (key) const final override;
kind get_kind (key) const final override;
label_text get_name_for_path_output (key) const final override;
key get_parent (key) const final override
{
return key ();
}
key
logical_location_from_funcname (const char *funcname);
private:
struct item
{
item (kind kind_,
const char *name)
: m_kind (kind_),
m_name (name)
{
}
kind m_kind;
const char *m_name;
};
const item *
item_from_funcname (const char *funcname);
static const item *item_from_key (key k)
{
return k.cast_to<const item *> ();
}
hash_map<nofree_string_hash, item *> m_name_to_item_map;
};
} // namespace diagnostics::logical_locations::selftest
} // namespace diagnostics::logical_locations::
} // namespace diagnostics
#endif /* #if CHECKING_P */
#endif /* GCC_DIAGNOSTICS_SELFTEST_LOGICAL_LOCATIONS_H. */
|