From: Daniel Jasper Date: Sat, 9 Jan 2016 15:56:57 +0000 (+0000) Subject: Make clang::format::reformat work with non 0-terminated strings. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9228ef3ed3a24509ae7314610210f61432948a9;p=clang Make clang::format::reformat work with non 0-terminated strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257259 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index ca3d08fa2c..2ea3b07a29 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1902,8 +1902,9 @@ tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, IntrusiveRefCntPtr(new DiagnosticIDs), new DiagnosticOptions); SourceManager SourceMgr(Diagnostics, Files); - InMemoryFileSystem->addFile(FileName, 0, - llvm::MemoryBuffer::getMemBuffer(Code, FileName)); + InMemoryFileSystem->addFile( + FileName, 0, llvm::MemoryBuffer::getMemBuffer( + Code, FileName, /*RequiresNullTerminator=*/false)); FileID ID = SourceMgr.createFileID(Files.getFile(FileName), SourceLocation(), clang::SrcMgr::C_User); SourceLocation StartOfFile = SourceMgr.getLocForStartOfFile(ID);