1 /* Interface between analyzer and frontends.
2 Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
5 This file is part of GCC.
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)
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.
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/>. */
21 #ifndef GCC_ANALYZER_LANGUAGE_H
22 #define GCC_ANALYZER_LANGUAGE_H
24 #include "analyzer/analyzer-logging.h"
30 /* Abstract base class for representing a specific TU
33 class translation_unit
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;
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
);
49 /* Analyzer hook for frontends to call at the end of the TU. */
51 void on_finish_translation_unit (const translation_unit
&tu
);
55 #endif /* #if ENABLE_ANALYZER */
57 #endif /* GCC_ANALYZER_LANGUAGE_H */