djasper added inline comments. ================ Comment at: lib/Format/Format.cpp:1484 @@ +1483,3 @@ + Environment::CreateVirtualEnvironment(Code, FileName, /*Ranges=*/{}); + FormatTokenLexer Lexer(Env->getSourceManager(), Env->getFileID(), Style, + encoding::detectEncoding(Code)); ---------------- Thinking about this some more, I think the FormatTokenLexer already does too much. Maybe just use a regular lexer?
const SourceManager& SourceMgr = Env->getSourceManager(); Lexer Lex(Env->getFileID(), SourceMgr.getBuffer(Env->getFileID()), SourceMgr, getFormattingLangOpts(Style)); Token Tok; int MinInsertOffset = Code.size(); while (Lex.LexFromRawLexer(&Tok)) { if (Tok.isNot(tok::comment)) { MinInsertOffset = SourceMgr.getFileOffset(Tok.getLocation()); break; } } http://reviews.llvm.org/D20898 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits