From d9228ef3ed3a24509ae7314610210f61432948a9 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Sat, 9 Jan 2016 15:56:57 +0000 Subject: [PATCH] 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 --- lib/Format/Format.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.50.1