yvvan added inline comments.
================ Comment at: lib/Sema/SemaCodeComplete.cpp:4109 + if (CodeCompleter->includeFixIts()) { + const SourceRange OpRange(OpLoc, OpLoc.getLocWithOffset(IsArrow ? 2 : 1)); + CompletionSucceded = ---------------- ilya-biryukov wrote: > yvvan wrote: > > ilya-biryukov wrote: > > > I'd use token ranges here to avoid assumptions about sizes of tokens, > > > e.g. `CreateReplacemen(CharSourceRange::getTokenRange(OpLoc, OpLoc), > > > IsArrow ? '.' : '->')` > > > There are complicated cases like `\` that end of the line and macros and > > > it's definitely better to use an abstraction that hides those cases. > > the problem is that I need the range, not just a location.... and I don't > > know how to extract it here. is there a way to get next token location here? > IIUC, using `CharSourceRange::getTokenRange(OpLoc, OpLoc)` will do what you > want. > When `CharSourceRange` is a token range, the client code should measurements > the token length and the producing code would use the starting location of > the last token. > Here are the relevant bits from the comment of the `CharSourceRange`: > ``` > /// In the token range case, the > /// size of the last token must be measured to determine the actual end of the > /// range. > ``` ok, i will recheck that it does calculate the token range https://reviews.llvm.org/D41537 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits