<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 10, 2011, at 10:41 AM, Ted Kremenek wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Nov 10, 2011, at 10:32 AM, Argyrios Kyrtzidis wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div>void SDiagsWriter::AddCharSourceRangeToRecord(CharSourceRange Range,<br>                                              RecordDataImpl &Record) {<br>  AddLocToRecord(Range.getBegin(), Record);<br>-  AddLocToRecord(Range.getEnd(), Record);<br>+  unsigned TokSize = 0;<br>+  if (Range.isTokenRange())<br>+    TokSize = Lexer::MeasureTokenLength(Range.getEnd(),<br>+                                        Diags.getSourceManager(),<br>+                                        *LangOpts);<br>+  <br>+  AddLocToRecord(Range.getEnd(), Record, TokSize);<br>}<br></div></blockquote><div><br></div><div>Instead of passing the TokSize to AddLocToRecord you could adjust the source location, like:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  AddLocToRecord(Range.getBegin(), Record);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span class="Apple-converted-space"> </span><span style="color: rgb(5, 97, 66); ">SourceLocation</span><span class="Apple-converted-space"> </span>CharEnd = Range.getEnd();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span class="Apple-converted-space"> </span><span style="color: rgb(145, 29, 103); ">if</span><span class="Apple-converted-space"> </span>(Range.isTokenRange()) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">   <span class="Apple-converted-space"> </span><span style="color: rgb(145, 29, 103); ">unsigned</span><span class="Apple-converted-space"> </span>TokSize =<span class="Apple-converted-space"> </span><span style="color: rgb(5, 97, 66); ">Lexer</span>::MeasureTokenLength(CharEnd,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">                                       <span class="Apple-converted-space"> </span><span style="color: rgb(2, 48, 201); ">Diags</span>.getSourceManager(),</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">                                        *<span style="color: rgb(2, 48, 201); ">LangOpts</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">    CharEnd = CharEnd.getLocWithOffset(TokSize);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; ">  <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  AddLocToRecord(CharEnd, Record);</div></div></div></div></div></div></div></span></blockquote></div><br><div>Seems like a reasonable simplification, although I don't think this really matters all that much.  Why bother creating a new SourceLocation when all we care about is adjusting the column one function call away?</div></div></blockquote><br></div><div>Not a big deal, you just adjust the location/column locally; FYI getLocWithOffset is just an addition to an unsigned.</div><br></body></html>