Thanks, that was the trick. I added "endBuf += Lexer::MeasureTokenLength( Stmt->getEndLoc(), *SM, TheRewriter.getLangOpts());" to my function and I am now getting the complete line. Thanks again Nat!