SourceLocation and offsets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

SourceLocation and offsets

Sebastian Redl

Trying to verify my knowledge of how the SourceManager works here.

It is my understanding that offsets are actually completely arbitrary: any given source buffer has a starting offset, and the buffer's contents are offset from there, but the order of source buffers in the global offset is pretty much completely arbitrary. This means that I could reorder the SLocEntries in SourceManager (shuffle the vector that holds them and recompute the starting offsets) and as long as I hunt down every SourceLocation and adjust its offset appropriately, nothing has changed.

Also, I'm trying to determine the exact meaning of the MacroIDBit in SourceLocation. It appears to me that it is a simple cache. If I were to look up the SLocEntry for a SourceLocation, am I guaranteed that Loc.isMacroID() == SLE.isInstantiation()? Because if that isn't correct, the difference is too subtle for me to understand.

cfe-dev mailing list
[hidden email]