[llvm-branch-commits] [clang-tools-extra] 467cbd2 - [clangd][NFC] Remove unnecessary copy in CodeComplete

Nathan James via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 8 18:36:51 PST 2021


Author: Nathan James
Date: 2021-01-09T02:32:23Z
New Revision: 467cbd2981840745a84dda07855c4e41501f6903

URL: https://github.com/llvm/llvm-project/commit/467cbd2981840745a84dda07855c4e41501f6903
DIFF: https://github.com/llvm/llvm-project/commit/467cbd2981840745a84dda07855c4e41501f6903.diff

LOG: [clangd][NFC] Remove unnecessary copy in CodeComplete

All tests still pass with ASAN so fairly confident no use-after-free going on here.

Added: 
    

Modified: 
    clang-tools-extra/clangd/CodeComplete.cpp

Removed: 
    


################################################################################
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<CodeCompleteConsumer> Consumer,
       offsetToClangLineColumn(Input.ParseInput.Contents, Input.Offset);
 
   std::unique_ptr<llvm::MemoryBuffer> 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


        


More information about the llvm-branch-commits mailing list