From: Sam McCall Date: Mon, 22 Jul 2019 11:12:16 +0000 (+0000) Subject: [clangd] Set buffer name for main file. NFCI X-Git-Tag: llvmorg-11-init~13886 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1df6be211e4c9cfbd842d3e37eaf7e90c3a40d40;p=platform%2Fupstream%2Fllvm.git [clangd] Set buffer name for main file. NFCI llvm-svn: 366675 --- diff --git a/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp index 3e9db70..9908fee 100644 --- a/clang-tools-extra/clangd/ClangdUnit.cpp +++ b/clang-tools-extra/clangd/ClangdUnit.cpp @@ -570,7 +570,8 @@ buildPreamble(PathRef FileName, CompilerInvocation &CI, PreambleParsedCallback PreambleCallback) { // Note that we don't need to copy the input contents, preamble can live // without those. - auto ContentsBuffer = llvm::MemoryBuffer::getMemBuffer(Inputs.Contents); + auto ContentsBuffer = + llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName); auto Bounds = ComputePreambleBounds(*CI.getLangOpts(), ContentsBuffer.get(), 0); @@ -650,10 +651,10 @@ buildAST(PathRef FileName, std::unique_ptr Invocation, // dirs. } - return ParsedAST::build(llvm::make_unique(*Invocation), - Preamble, - llvm::MemoryBuffer::getMemBufferCopy(Inputs.Contents), - std::move(VFS), Inputs.Index, Inputs.Opts); + return ParsedAST::build( + llvm::make_unique(*Invocation), Preamble, + llvm::MemoryBuffer::getMemBufferCopy(Inputs.Contents, FileName), + std::move(VFS), Inputs.Index, Inputs.Opts); } SourceLocation getBeginningOfIdentifier(const ParsedAST &Unit,