"liuml07 [via LLVM]" <<a href="/user/SendEmail.jtp?type=node&node=56667&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> writes:
<br/><br/>There is a `std::reverse_iterator' that might be useful. See this page
<br/>below for more information.
<br/><br/><a href="https://github.com/jirislaby/LLVMSlicer/blob/master/src/Slicing/FunctionStaticSlicer.cpp#L331" target="_top" rel="nofollow" link="external">https://github.com/jirislaby/LLVMSlicer/blob/master/src/Slicing/FunctionStaticSlicer.cpp#L331</a><br/><div class='shrinkable-quote'><br/>> Hi all,
<br/>>
<br/>> I need to know the line number range of a function. The start of the function
<br/>> line number can be found by the definition point, which is stored at the
<br/>> subprogram metadata: DISubprogram::getLineNumber().
<br/>>
<br/>> However, there is no API (or the metadata in the first place) to know the end of
<br/>> the function.
<br/>>
<br/>> I have to visit all the instructions of the function and maintain the max line
<br/>> number of the instructions. I use the inst_begin(func): inst_end(func) as the
<br/>> iterator. But I don't think it's effective to iterate all the instructions from
<br/>> the beginning. It's supposed that we can iterate the instructions reversely and
<br/>> the first one who has attached metadata should be treated as the end of the
<br/>> function. Unfortunately, there is no reverse iterator of a function.
<br/>>
<br/>> Any idea?
<br/>>
<br/>> Thank you very much!
</div><br/>-- 
<br/>Regards,
<br/>Hongxu Chen
<br/>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/The-line-number-range-of-a-function-in-source-code-level-tp56664p56667.html">Re: The line number range of a function in source code level</a><br/>
Sent from the <a href="http://llvm.1065342.n5.nabble.com/LLVM-Dev-f3.html">LLVM - Dev mailing list archive</a> at Nabble.com.<br/>