<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 1, 2016, at 1:18 PM, Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 1, 2016 at 12:42 PM, Manman Ren via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">manmanren added a comment.<br class="">
<span class=""><br class="">
In <a href="http://reviews.llvm.org/D20844#445762" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D20844#445762</a>, @rjmccall wrote:<br class="">
<br class="">
> Hmm.  No, I think the original code is correct here — RangeEnd is a token range, and those are generally inclusive rather than exclusive.  The fix-it needs to be inserting at the end of the token.<br class="">
<br class="">
<br class="">
</span>We currently insert the fix-it here<br class="">
SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();<br class=""></blockquote><div class=""><br class=""></div><div class="">Yep, that's the bug. That source location refers to the start of the last token in the source range.</div></div></div></div></div></blockquote><div><br class=""></div>Thanks for the clarification!</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And we call "TL.setNameEndLoc(DS.getLocEnd());" for ObjCInterfaceTypeLoc.<br class="">
<br class="">
The problem is that for annotation token, both the start and the end point to the same location. With "DS.SetRangeEnd(Tok.getAnnotationEndLoc());", the DeclSpec has the same start and end location.<br class="">
<br class="">
Is there a way to get the real end of the annotation token, since getAnnotationEndLoc returns the start location?<br class=""></blockquote><div class=""><br class=""></div><div class="">You can use Preprocessor::getLocForEndOfToken to get the character location past the end of the token. (If you want the * to be after the space in your example, you'll need to also skip that whitespace.)<br class=""></div></div></div></div></div></blockquote><div><br class=""></div>I will  update the patch with your suggestion.<div><br class=""></div><div>Thanks,</div><div>Manman</div><blockquote type="cite" class=""><div class="">
_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<br class=""></div></blockquote></div><br class=""></body></html>