[cfe-dev] Expansion location and spelling location

Volodymyr Sapsai vsapsai at gmail.com
Fri May 4 16:36:49 PDT 2012


Hi,

I'd like to ask about the difference between expansion and spelling locations.
For example, if I have code
#define MACRO_INC "tests/indirect.h"
#include MACRO_INC
and I am in PPCallbacks::FileChanged() method

then expansion location is
#define MACRO_INC "tests/indirect.h"
                  ^
#include MACRO_INC

and spelling location is
#define MACRO_INC "tests/indirect.h"
#include MACRO_INC
         ^

Am I right?

Some more details for my problem. In PPCallbacks::FileChanged(loc, ...) is used
SourceManager()->getPresumedLoc(loc).getIncludeLoc() and for this includeLoc
earlier I received "tests/indirect.h"\n#include MACRO_INC\n but now I
receive MACRO_INC\n. Also in SourceManager documentation is written
> Note that a presumed location is always given as the expansion point of an
> expansion location, not at the spelling location.
So I want to clarify if getPresumedLoc() incorrectly returns spelling location
or I don't understand what does spelling location mean.

Thanks,
Volodymyr Sapsai



More information about the cfe-dev mailing list