summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/ClangFormat.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2017-02-25 03:45:49 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2017-02-25 03:45:49 +0000
commitd274dc3896a163f3216ccdb67fe56c7f27e471b9 (patch)
tree14bfdb8aa78d287a87e07cb84194851ff2bfa111 /clang/tools/clang-format/ClangFormat.cpp
parentdb895d839f7845146ac66e87eb54ec2968bed967 (diff)
downloadbcm5719-llvm-d274dc3896a163f3216ccdb67fe56c7f27e471b9.tar.gz
bcm5719-llvm-d274dc3896a163f3216ccdb67fe56c7f27e471b9.zip
Revert r296166, "clang-format: Don't leave behind temp files in -i mode on Windows, PR26125", and r296171.
(MemoryBuffer)Code.reset() was too early. ==26912== Invalid read of size 1 ==26912== at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, bool) (MemoryBuffer.cpp:47) ==26912== by 0x438013: (anonymous namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) (MemoryBuffer.cpp:86) ==26912== by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (MemoryBuffer.cpp:112) ==26912== by 0x4E189D: clang::vfs::detail::(anonymous namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:443) ==26912== by 0x4DF5BA: clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:94) ==26912== by 0x4B72EC: clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) (FileManager.cpp:443) ==26912== by 0x4C1F81: clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, clang::SourceManager const&, clang::SourceLocation, bool*) const (SourceManager.cpp:98) ==26912== by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, bool*) const (SourceManager.cpp:689) ==26912== by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) (Rewriter.cpp:230) ==26912== by 0x407297: clang::format::format(llvm::StringRef) (ClangFormat.cpp:311) ==26912== by 0x4078D7: main (ClangFormat.cpp:363) llvm-svn: 296237
Diffstat (limited to 'clang/tools/clang-format/ClangFormat.cpp')
-rw-r--r--clang/tools/clang-format/ClangFormat.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index 47946d87342..941f90396d7 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -296,7 +296,6 @@ static bool format(StringRef FileName) {
InMemoryFileSystem.get());
Rewriter Rewrite(Sources, LangOptions());
tooling::applyAllReplacements(Replaces, Rewrite);
- Code.reset();
if (Inplace) {
if (FileName == "-")
errs() << "error: cannot use -i when reading from stdin.\n";
OpenPOWER on IntegriCloud