diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp --- a/clang-tools-extra/clangd/Selection.cpp +++ b/clang-tools-extra/clangd/Selection.cpp @@ -465,11 +465,12 @@ } #ifndef NDEBUG -std::string printNodeToString(const DynTypedNode &N, const PrintingPolicy &PP) { +std::string printNodeToString(const DynTypedNode &N, const PrintingPolicy &PP, + const SourceManager &SM) { std::string S; llvm::raw_string_ostream OS(S); printNodeKind(OS, N); - OS << " "; + OS << " " << N.getSourceRange().printToString(SM) << " "; return std::move(OS.str()); } #endif @@ -699,7 +700,7 @@ [](const Attr *A) { return !A->isImplicit(); })) return false; if (!SelChecker.mayHit(S)) { - dlog("{1}skip: {0}", printNodeToString(N, PrintPolicy), indent()); + dlog("{1}skip: {0}", printNodeToString(N, PrintPolicy, SM), indent()); dlog("{1}skipped range = {0}", S.printToString(SM), indent(1)); return true; } @@ -717,7 +718,7 @@ // Pushes a node onto the ancestor stack. Pairs with pop(). void push(DynTypedNode Node) { - dlog("{1}push: {0}", printNodeToString(Node, PrintPolicy), indent()); + dlog("{1}push: {0}", printNodeToString(Node, PrintPolicy, SM), indent()); Nodes.emplace_back(); Nodes.back().ASTNode = std::move(Node); Nodes.back().Parent = Stack.top(); @@ -729,7 +730,8 @@ // Performs primary hit detection. void pop() { Node &N = *Stack.top(); - dlog("{1}pop: {0}", printNodeToString(N.ASTNode, PrintPolicy), indent(-1)); + dlog("{1}pop: {0}", printNodeToString(N.ASTNode, PrintPolicy, SM), + indent(-1)); claimTokensFor(N.ASTNode, N.Selected); if (N.Selected == NoTokens) N.Selected = SelectionTree::Unselected;