| 1 |
/* Interface between analyzer and frontends. |
| 2 |
Copyright (C) 2022-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 |
| 8 |
under the terms of the GNU General Public License as published by |
| 9 |
the Free Software Foundation; either version 3, or (at your option) |
| 10 |
any later version. |
| 11 |
|
| 12 |
GCC is distributed in the hope that it will be useful, but |
| 13 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
General Public License 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_ANALYZER_LANGUAGE_H |
| 22 |
#define GCC_ANALYZER_LANGUAGE_H |
| 23 |
|
| 24 |
#include "analyzer/analyzer-logging.h" |
| 25 |
|
| 26 |
#if ENABLE_ANALYZER |
| 27 |
|
| 28 |
namespace ana { |
| 29 |
|
| 30 |
/* Abstract base class for representing a specific TU |
| 31 |
to the analyzer. */ |
| 32 |
|
| 33 |
class translation_unit |
| 34 |
{ |
| 35 |
public: |
| 36 |
/* Attempt to look up an value for identifier ID (e.g. in the headers that |
| 37 |
have been seen). If it is defined and an integer (e.g. either as a |
| 38 |
macro or enum), return the INTEGER_CST value, otherwise return NULL. */ |
| 39 |
virtual tree lookup_constant_by_id (tree id) const = 0; |
| 40 |
virtual tree lookup_type_by_id (tree id) const = 0; |
| 41 |
virtual tree lookup_global_var_by_id (tree id) const = 0; |
| 42 |
}; |
| 43 |
|
| 44 |
typedef void (*finish_translation_unit_callback) |
| 45 |
(logger *, const translation_unit &); |
| 46 |
void register_finish_translation_unit_callback ( |
| 47 |
finish_translation_unit_callback callback); |
| 48 |
|
| 49 |
/* Analyzer hook for frontends to call at the end of the TU. */ |
| 50 |
|
| 51 |
void on_finish_translation_unit (const translation_unit &tu); |
| 52 |
|
| 53 |
} // namespace ana |
| 54 |
|
| 55 |
#endif /* #if ENABLE_ANALYZER */ |
| 56 |
|
| 57 |
#endif /* GCC_ANALYZER_LANGUAGE_H */ |