diff options
Diffstat (limited to 'clang-tools-extra/clangd/FileDistance.cpp')
-rw-r--r-- | clang-tools-extra/clangd/FileDistance.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/clang-tools-extra/clangd/FileDistance.cpp b/clang-tools-extra/clangd/FileDistance.cpp index 5a3650af27b..a0ce25b48fa 100644 --- a/clang-tools-extra/clangd/FileDistance.cpp +++ b/clang-tools-extra/clangd/FileDistance.cpp @@ -35,7 +35,6 @@ #include "Logger.h" #include "llvm/ADT/STLExtras.h" #include <queue> -#define DEBUG_TYPE "FileDistance" namespace clang { namespace clangd { @@ -64,8 +63,8 @@ FileDistance::FileDistance(StringMap<SourceParams> Sources, // Keep track of down edges, in case we can use them to improve on this. for (const auto &S : Sources) { auto Canonical = canonicalize(S.getKey()); - LLVM_DEBUG(dbgs() << "Source " << Canonical << " = " << S.second.Cost - << ", MaxUp=" << S.second.MaxUpTraversals << "\n"); + dlog("Source {0} = {1}, MaxUp = {2}", Canonical, S.second.Cost, + S.second.MaxUpTraversals); // Walk up to ancestors of this source, assigning cost. StringRef Rest = Canonical; llvm::hash_code Hash = hash_value(Rest); @@ -134,7 +133,7 @@ unsigned FileDistance::distance(StringRef Path) { Cost += Opts.DownCost; Cache.try_emplace(Hash, Cost); } - LLVM_DEBUG(dbgs() << "distance(" << Path << ") = " << Cost << "\n"); + dlog("distance({0} = {1})", Path, Cost); return Cost; } @@ -143,12 +142,10 @@ unsigned URIDistance::distance(llvm::StringRef URI) { if (!R.second) return R.first->getSecond(); if (auto U = clangd::URI::parse(URI)) { - LLVM_DEBUG(dbgs() << "distance(" << URI << ") = distance(" << U->body() - << ")\n"); + dlog("distance({0} = {1})", URI, U->body()); R.first->second = forScheme(U->scheme()).distance(U->body()); } else { - log("URIDistance::distance() of unparseable " + URI + ": " + - llvm::toString(U.takeError())); + log("URIDistance::distance() of unparseable {0}: {1}", URI, U.takeError()); } return R.first->second; } @@ -163,9 +160,8 @@ FileDistance &URIDistance::forScheme(llvm::StringRef Scheme) { else consumeError(U.takeError()); } - LLVM_DEBUG(dbgs() << "FileDistance for scheme " << Scheme << ": " - << SchemeSources.size() << "/" << Sources.size() - << " sources\n"); + dlog("FileDistance for scheme {0}: {1}/{2} sources", Scheme, + SchemeSources.size(), Sources.size()); Delegate.reset(new FileDistance(std::move(SchemeSources), Opts)); } return *Delegate; |