aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-04-28 18:21:23 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-04-28 18:21:23 -0400
commit13f4b12393fa9813b57f5d2dff0753945a2812ce (patch)
tree1901a8baa28dcf756a8a3f11687d9b3058608f71 /gcc
parentcf5fb8f156b68b8a01e79a9471eeabebd499ea61 (diff)
downloadgcc-13f4b12393fa9813b57f5d2dff0753945a2812ce.zip
gcc-13f4b12393fa9813b57f5d2dff0753945a2812ce.tar.gz
gcc-13f4b12393fa9813b57f5d2dff0753945a2812ce.tar.bz2
analyzer,c++: add placeholder implementation of ana::translation_unit for C++
Implement ana::translation_unit for the C++ frontend with a no-op placeholder implementation, for now. No functional change intended; a follow-up may implement things further. gcc/cp/ChangeLog: * parser.cc: Include "analyzer/analyzer-language.h". (ana::cp_translation_unit): New class. (cp_parser_translation_unit): Add call to ana::on_finish_translation_unit. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/parser.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index e165b2a..1fb9e7f 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "contracts.h"
#include "bitmap.h"
#include "builtins.h"
+#include "analyzer/analyzer-language.h"
/* The lexer. */
@@ -286,6 +287,37 @@ static FILE *cp_lexer_debug_stream;
sizeof, typeof, or alignof. */
int cp_unevaluated_operand;
+#if ENABLE_ANALYZER
+
+namespace ana {
+
+/* Concrete implementation of ana::translation_unit for the C++ frontend. */
+
+class cp_translation_unit : public translation_unit
+{
+public:
+ tree lookup_constant_by_id (tree /*id*/) const final override
+ {
+ return NULL_TREE;
+ }
+
+ tree
+ lookup_type_by_id (tree /*id*/) const final override
+ {
+ return NULL_TREE;
+ }
+
+ tree
+ lookup_global_var_by_id (tree /*id*/) const final override
+ {
+ return NULL_TREE;
+ }
+};
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
+
/* Dump up to NUM tokens in BUFFER to FILE starting with token
START_TOKEN. If START_TOKEN is NULL, the dump starts with the
first token in BUFFER. If NUM is 0, dump all the tokens. If
@@ -5471,6 +5503,14 @@ cp_parser_translation_unit (cp_parser* parser)
cp_parser_toplevel_declaration (parser);
}
+#if ENABLE_ANALYZER
+ if (flag_analyzer)
+ {
+ ana::cp_translation_unit tu;
+ ana::on_finish_translation_unit (tu);
+ }
+#endif
+
/* Get rid of the token array; we don't need it any more. */
cp_lexer_destroy (parser->lexer);
parser->lexer = NULL;