[cfe-dev] Changing column number in SourceLocation object

Rafael Stahl via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 28 04:45:49 PDT 2019


Hi Ijaz,

a SourceLocation object points to a specific location inside a buffer. 
The line and column information is derived from that via the 
SourceManager. The locations are immutable, but you can create a 
modified copy with SourceLocation::getLocWithOffset.

I'm not familiar with a direct way to change the line number, but maybe 
you can figure out an appropriate method for your use-case with the 
helpers in the Preprocessor or Lexer classes (e.g. advance to next token).

-Rafael

On 27.10.19 06:07, Ijaz Ahmed via cfe-dev wrote:
> Dear All,
>
> Let suppose, I have a object "startLoc" of class "SourceLocation". The 
> object contains line and column number information. How can I modify 
> the line number in startLoc object? I was expecting "set()" kind of 
> methods for class SourceLocation, but I could not find any. I would be 
> thankful for your help.
>
> Regards
> Ijaz
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191028/6b6c4e82/attachment.html>


More information about the cfe-dev mailing list