public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Accessing AST
@ 2023-11-28 18:31 Swhhcsj Jrwhcjxd
  0 siblings, 0 replies; only message in thread
From: Swhhcsj Jrwhcjxd @ 2023-11-28 18:31 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

How to access AST for a given .cpp file after it is parsed by cp/parser.cc
?

Looking at struct cp_parser, there are several tree fields, but none of
them seem to correspond to the AST.  None of the functions downstream from
parse_file() seem to access any object that would resemble AST. So I have
trouble locating where the constructed AST is stored.

I would like to traverse the AST to do some minor modifications, like
setting unassigned pointers to NULL, checking bounds for pointer
arithmetics in expressions like (x+n), preventing pointer casts to (long
int), preventing pointer casts ( or checking object alignment, to ensure
consistency of pointer cast) and the like, for which AST seems like the
place to do these alterations.


Thanks,
schw

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-28 18:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 18:31 Accessing AST Swhhcsj Jrwhcjxd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).