r257259 - Make clang::format::reformat work with non 0-terminated strings.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 9 07:56:57 PST 2016


Author: djasper
Date: Sat Jan  9 09:56:57 2016
New Revision: 257259

URL: http://llvm.org/viewvc/llvm-project?rev=257259&view=rev
Log:
Make clang::format::reformat work with non 0-terminated strings.

Modified:
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=257259&r1=257258&r2=257259&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Sat Jan  9 09:56:57 2016
@@ -1902,8 +1902,9 @@ tooling::Replacements reformat(const For
       IntrusiveRefCntPtr<DiagnosticIDs>(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);




More information about the cfe-commits mailing list