On Tue, Nov 24, 2020 at 12:05 AM Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi, > > Does gcc provide an iterator to traverse all the local variables that are > declared in the current routine? > > If not, what’s the best way to traverse the local variables?
Depends on what for. There's the source level view you get by walking BLOCK_VARS of the scope tree, theres cfun->local_variables (FOR_EACH_LOCAL_DECL) and there's SSA names (FOR_EACH_SSA_NAME). Richard. > > Thanks. > > Qing