From 467cbd2981840745a84dda07855c4e41501f6903 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Sat, 9 Jan 2021 02:32:23 +0000 Subject: [PATCH] [clangd][NFC] Remove unnecessary copy in CodeComplete All tests still pass with ASAN so fairly confident no use-after-free going on here. --- clang-tools-extra/clangd/CodeComplete.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 1a8474f6c53d..53c647a68788 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -1111,8 +1111,8 @@ bool semaCodeComplete(std::unique_ptr Consumer, offsetToClangLineColumn(Input.ParseInput.Contents, Input.Offset); std::unique_ptr ContentsBuffer = - llvm::MemoryBuffer::getMemBufferCopy(Input.ParseInput.Contents, - Input.FileName); + llvm::MemoryBuffer::getMemBuffer(Input.ParseInput.Contents, + Input.FileName); // The diagnostic options must be set before creating a CompilerInstance. CI->getDiagnosticOpts().IgnoreWarnings = true; // We reuse the preamble whether it's valid or not. This is a