[cfe-dev] How to create a SourceLocation from line number?

Welson Sun welson.sun at gmail.com
Fri Jan 9 10:09:07 PST 2015


A related question: how do you get the line number from a SourceLocation.
There is something in FullSourceLocation, but you can only get the
SourceLocation from a Stmt.

-Welson

On Thu, Jan 8, 2015 at 5:35 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Thu, Jan 8, 2015 at 1:14 PM, Sean Silva <chisophugis at gmail.com> wrote:
>
>>
>>
>> On Thu, Jan 8, 2015 at 12:44 AM, Csaba Raduly <rcsaba at gmail.com> wrote:
>>
>>> On Wed, Jan 7, 2015 at 10:22 PM, Sean Silva <chisophugis at gmail.com>
>>> wrote:
>>> > Does SourceManager::translateFileLineCol work for you?
>>> >
>>> >
>>> http://clang.llvm.org/doxygen/classclang_1_1SourceManager.html#a5573aab1578a194e43c7934e6902aeec
>>>
>>> Which says:
>>> "
>>> If the source file is included multiple times, the source location
>>> will be based upon the first inclusion.
>>> If the source file is included multiple times, the source location
>>> will be based upon an arbitrary inclusion.
>>> "
>>>
>>> These two sentences contradict each other.
>>>
>>>
>> Indeed. Which one is it?
>>
>
> ... and that's why you don't duplicate function comments between header
> and source file. =)
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>


-- 
- Welson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150109/84fce462/attachment.html>


More information about the cfe-dev mailing list