[clangd] Get rid of redundant make_uniques
authorKadir Cetinkaya <kadircet@google.com>
Thu, 2 Apr 2020 14:51:59 +0000 (16:51 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Thu, 2 Apr 2020 14:52:13 +0000 (16:52 +0200)
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/clangd/TUScheduler.cpp

index 2c7cb5d..f620587 100644 (file)
@@ -551,8 +551,7 @@ buildAST(PathRef FileName, std::unique_ptr<CompilerInvocation> Invocation,
   }
 
   return ParsedAST::build(
-      Inputs.Version, std::make_unique<CompilerInvocation>(*Invocation),
-      CompilerInvocationDiags, Preamble,
+      Inputs.Version, std::move(Invocation), CompilerInvocationDiags, Preamble,
       llvm::MemoryBuffer::getMemBufferCopy(Inputs.Contents, FileName),
       std::move(VFS), Inputs.Index, Inputs.Opts);
 }
index e5a0019..a2df2c3 100644 (file)
@@ -569,12 +569,10 @@ void ASTWorker::runWithAST(
       vlog("ASTWorker rebuilding evicted AST to run {0}: {1} version {2}", Name,
            FileName, CurrentInputs->Version);
       llvm::Optional<ParsedAST> NewAST =
-          Invocation
-              ? buildAST(FileName,
-                         std::make_unique<CompilerInvocation>(*Invocation),
-                         CompilerInvocationDiagConsumer.take(), *CurrentInputs,
-                         getPossiblyStalePreamble())
-              : None;
+          Invocation ? buildAST(FileName, std::move(Invocation),
+                                CompilerInvocationDiagConsumer.take(),
+                                *CurrentInputs, getPossiblyStalePreamble())
+                     : None;
       AST = NewAST ? std::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
     }
     // Make sure we put the AST back into the LRU cache.