aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-01-09 15:56:57 +0000
committerDaniel Jasper <djasper@google.com>2016-01-09 15:56:57 +0000
commit88c163460cbe0cad01eef47cceb4f607261b9e66 (patch)
tree9fd2e28e4bcdb3af762fcb1083b8b34681db755b /clang
parent417fc81540b529f51649ba0ce82489e496b70ace (diff)
downloadllvm-88c163460cbe0cad01eef47cceb4f607261b9e66.zip
llvm-88c163460cbe0cad01eef47cceb4f607261b9e66.tar.gz
llvm-88c163460cbe0cad01eef47cceb4f607261b9e66.tar.bz2
Make clang::format::reformat work with non 0-terminated strings.
llvm-svn: 257259
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/Format.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ca3d08f..2ea3b07 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1902,8 +1902,9 @@ tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
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);