[formatting] Refrain from std::make_unique until migration to C++14 or C++17

This commit is contained in:
Fangrui Song 2017-12-31 15:55:55 -08:00
parent cd2f3c1e45
commit f9aa0ef66d

View File

@ -60,10 +60,11 @@ struct TextDocumentFormattingHandler
int tab_size = request->params.options.tabSize; int tab_size = request->params.options.tabSize;
bool insert_spaces = request->params.options.insertSpaces; bool insert_spaces = request->params.options.insertSpaces;
const auto clang_format = std::unique_ptr<ClangFormat>(new ClangFormat( const auto clang_format = MakeUnique<ClangFormat>(
working_file->filename, working_file->buffer_content, working_file->filename, working_file->buffer_content,
{clang::tooling::Range(0, working_file->buffer_content.size())}, llvm::ArrayRef<clang::tooling::Range>(
tab_size, insert_spaces)); clang::tooling::Range(0, working_file->buffer_content.size())),
tab_size, insert_spaces);
const auto replacements = clang_format->FormatWholeDocument(); const auto replacements = clang_format->FormatWholeDocument();
response.result = ConvertClangReplacementsIntoTextEdits( response.result = ConvertClangReplacementsIntoTextEdits(
working_file->buffer_content, replacements); working_file->buffer_content, replacements);