Expansion location and spelling location

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

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?

I think this is exactly reverted :slight_smile: The spelling location is where the
user spelled the *code* (in this case the code is "tests/indicrect.h",
the expansion location is where the macro name is written.

Cheers,
/Manuel

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?

I think this is exactly reverted :slight_smile: The spelling location is where the
user spelled the *code* (in this case the code is "tests/indicrect.h",
the expansion location is where the macro name is written.

Cheers,
/Manuel

Thanks. I've played a little bit with different locations and now
understand the difference.

Regards,
Volodymyr Sapsai