Stream: t-compiler/help

Topic: exact macro expansion

Areredify (Jan 26 2020 at 13:56, on Zulip):

I am trying to check if a given expr is an exact expansion of a macro (that is, the macro expanded precisely to my expr). My approach right now is to compare outer ExpnId's of the expr and its parent. If they match, then the expansion is bigger than my expr. The problem is that a built-in macro (namely format_args) expansion has exprs whose outer expansion is not format_args (its the calling macro instead). Their parent node's outer expansion, on the other hand, is format_args, I compare them and get a false positive. Is there an easier way to achieve my goal that I am not aware of? If not, can you think of the way to fix approach?

Last update: Sep 22 2020 at 02:30UTC