From 199a5071efecbf9e71d53a505746fd33e125f458 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Thu, 21 Dec 2017 14:05:28 +0000 Subject: [clangd] Log more info about preambles --- clang-tools-extra/clangd/ClangdUnit.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'clang-tools-extra/clangd/ClangdUnit.cpp') diff --git a/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp index b6bf3f75eaa..5fa8cd33a9b 100644 --- a/clang-tools-extra/clangd/ClangdUnit.cpp +++ b/clang-tools-extra/clangd/ClangdUnit.cpp @@ -513,10 +513,13 @@ CppFile::deferRebuild(StringRef NewContents, ComputePreambleBounds(*CI->getLangOpts(), ContentsBuffer.get(), 0); if (OldPreamble && OldPreamble->Preamble.CanReuse( *CI, ContentsBuffer.get(), Bounds, VFS.get())) { + log(Ctx, "Reusing preamble for file " + Twine(That->FileName)); return OldPreamble; } - // We won't need the OldPreamble anymore, release it so it can be deleted - // (if there are no other references to it). + log(Ctx, "Premble for file " + Twine(That->FileName) + + " cannot be reused. Attempting to rebuild it."); + // We won't need the OldPreamble anymore, release it so it can be + // deleted (if there are no other references to it). OldPreamble.reset(); trace::Span Tracer(Ctx, "Preamble"); @@ -533,11 +536,16 @@ CppFile::deferRebuild(StringRef NewContents, SerializedDeclsCollector); if (BuiltPreamble) { + log(Ctx, "Built preamble of size " + Twine(BuiltPreamble->getSize()) + + " for file " + Twine(That->FileName)); + return std::make_shared( std::move(*BuiltPreamble), SerializedDeclsCollector.takeTopLevelDeclIDs(), std::move(PreambleDiags)); } else { + log(Ctx, + "Could not build a preamble for file " + Twine(That->FileName)); return nullptr; } }; -- cgit v1.2.3