<div dir="ltr">I get the location with :<div><div> SourceManager &SM = context.getSourceManager();</div><div> int lineStart = SM.getPresumedLoc(SR->getBegin()).getLine();</div><div> int lineEnd = SM.getPresumedLoc(SR->getEnd()).getLine();</div>
<div> int colStart = SM.getPresumedLoc(SR->getBegin()).getColumn();</div><div> int colEnd = SM.getPresumedLoc(SR->getEnd()).getColumn();</div></div><div> llvm::outs() << "For:" << lineStart << " " << colStart << " " << lineEnd << " " << colEnd << " \n";</div>
<div><br></div><div>the testCase:</div><div><br></div><div><div>for(i = 0 ; i<100;i++)</div><div>sum++;</div></div><div><br></div><div>result is:</div><div><br></div><div>For:44 1 45 4 <br></div><div><br></div><div>
But when the testcase :</div><div><br></div><div><div>for(i = 0 ; i<100;i++)</div><div>{sum++;}</div></div><div><br></div><div>result is</div><div><br></div><div>For:44 1 45 8 <br></div><div><br></div><div>I don't know whether is a bug.</div>
<div><br></div><div>Thanks.</div></div>