Skip to content

Commit 467cbd2

Browse files
committed
[clangd][NFC] Remove unnecessary copy in CodeComplete
All tests still pass with ASAN so fairly confident no use-after-free going on here.
1 parent 7d78875 commit 467cbd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,8 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
11111111
offsetToClangLineColumn(Input.ParseInput.Contents, Input.Offset);
11121112

11131113
std::unique_ptr<llvm::MemoryBuffer> ContentsBuffer =
1114-
llvm::MemoryBuffer::getMemBufferCopy(Input.ParseInput.Contents,
1115-
Input.FileName);
1114+
llvm::MemoryBuffer::getMemBuffer(Input.ParseInput.Contents,
1115+
Input.FileName);
11161116
// The diagnostic options must be set before creating a CompilerInstance.
11171117
CI->getDiagnosticOpts().IgnoreWarnings = true;
11181118
// We reuse the preamble whether it's valid or not. This is a

0 commit comments

Comments
 (0)