[cfe-dev] Check if a location comes from begin/end of macro argument expansion

Abramo Bagnara abramo.bagnara at bugseng.com
Wed Oct 10 14:36:35 PDT 2012


I'm struggling to find a way to detect if a given macro expanded
location is at the begin (or the end) of a macro argument expansion.

e.g. in this program

#define M(z) 0 + z + 0
#define N(x) M((x))
void h() {
  N(1);
}

I'd need to detect that source location of integer literal 1 is at the
begin (and the end) of expansion of argument x of macro N.

I think we should have enough info to do that (I've been able to reach a
similar result concerning macro expansion begin/end), but I'm still
unable to achieve always the correct final result.

I'd be very happy if Argyrios or another SourceManager guru could shed
some light on that.

-- 
Abramo Bagnara

BUGSENG srl - http://bugseng.com
mailto:abramo.bagnara at bugseng.com



More information about the cfe-dev mailing list