[clang-tools-extra] r321267 - [clangd] Log more info about preambles

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 06:05:28 PST 2017


Author: ibiryukov
Date: Thu Dec 21 06:05:28 2017
New Revision: 321267

URL: http://llvm.org/viewvc/llvm-project?rev=321267&view=rev
Log:
[clangd] Log more info about preambles

Modified:
    clang-tools-extra/trunk/clangd/ClangdUnit.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=321267&r1=321266&r2=321267&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Thu Dec 21 06:05:28 2017
@@ -513,10 +513,13 @@ CppFile::deferRebuild(StringRef NewConte
           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 NewConte
           SerializedDeclsCollector);
 
       if (BuiltPreamble) {
+        log(Ctx, "Built preamble of size " + Twine(BuiltPreamble->getSize()) +
+                     " for file " + Twine(That->FileName));
+
         return std::make_shared<PreambleData>(
             std::move(*BuiltPreamble),
             SerializedDeclsCollector.takeTopLevelDeclIDs(),
             std::move(PreambleDiags));
       } else {
+        log(Ctx,
+            "Could not build a preamble for file " + Twine(That->FileName));
         return nullptr;
       }
     };




More information about the cfe-commits mailing list