| 1 | /* Concrete subclass of logical_location for use in selftests. |
| 2 | Copyright (C) 2024-2025 Free Software Foundation, Inc. |
| 3 | Contributed by David Malcolm <[email protected]>. |
| 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_SELFTEST_LOGICAL_LOCATION_H |
| 22 | #define GCC_SELFTEST_LOGICAL_LOCATION_H |
| 23 | |
| 24 | #include "logical-location.h" |
| 25 | |
| 26 | /* The selftest code should entirely disappear in a production |
| 27 | configuration, hence we guard all of it with #if CHECKING_P. */ |
| 28 | |
| 29 | #if CHECKING_P |
| 30 | |
| 31 | namespace selftest { |
| 32 | |
| 33 | /* Concrete subclass of logical_location for use in selftests. */ |
| 34 | |
| 35 | class test_logical_location : public logical_location |
| 36 | { |
| 37 | public: |
| 38 | test_logical_location (enum logical_location_kind kind, |
| 39 | const char *name); |
| 40 | virtual const char *get_short_name () const final override; |
| 41 | virtual const char *get_name_with_scope () const final override; |
| 42 | virtual const char *get_internal_name () const final override; |
| 43 | virtual enum logical_location_kind get_kind () const final override; |
| 44 | virtual label_text get_name_for_path_output () const final override; |
| 45 | |
| 46 | const char *get_name () const { return m_name; } |
| 47 | |
| 48 | private: |
| 49 | enum logical_location_kind m_kind; |
| 50 | const char *m_name; |
| 51 | }; |
| 52 | |
| 53 | } // namespace selftest |
| 54 | |
| 55 | #endif /* #if CHECKING_P */ |
| 56 | |
| 57 | |
| 58 | #endif /* GCC_SELFTEST_LOGICAL_LOCATION_H. */ |