Confused about SourceLocs

Hi all,

is it correct that both the logical and the physical location of a macro SourceLoc are always file SourceLocs?

Just out of curiosity: Does clang in any way store which macro calls which other macros?

Finally, the attached patch adds some functions to FullSourceLocation that are useful in my eyes. It also modifies isValidMacroPhysOffs() to use the complete range of a two's complement integer.

Nico

locs.patch (3.13 KB)

Hi all,

is it correct that both the logical and the physical location of a macro SourceLoc are always file SourceLocs?

yes.

Just out of curiosity: Does clang in any way store which macro calls which other macros?

No, not currently. I'm planning an eventual revamp of SourceLocation that could capture this. Right now it doesn't though.

Finally, the attached patch adds some functions to FullSourceLocation that are useful in my eyes. It also modifies isValidMacroPhysOffs() to use the complete range of a two's complement integer.

Applied, thanks!
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080929/007816.html

I tweaked Dump to rename it dump(), make it const, and change it to use stdio instead of streams.

-Chris

Chris Lattner wrote:

This is done now. Each token's SourceLocation retains the full macro instantiation history of the token.

-Chris