[PATCH] D117475: [clangd] NFC, emit source ranges in selection debug messages.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 18 14:29:56 PST 2022
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/Selection.cpp:473
printNodeKind(OS, N);
- OS << " ";
+ OS << " " << N.getSourceRange().printToString(SM) << " ";
return std::move(OS.str());
----------------
I don't think this belongs in printNodeToString but rather explicitly in the log statements that call it.
================
Comment at: clang-tools-extra/clangd/Selection.cpp:704
+ dlog("{1}skip: {0}", printNodeToString(N, PrintPolicy, SM), indent());
dlog("{1}skipped range = {0}", S.printToString(SM), indent(1));
return true;
----------------
We're already printing the range here, which only differs rarely. This seems noisy and confusing.
(S is a better range to print than N.getSourceRange here - no objection if you want to change the log formatting to print it similarly to the others)
================
Comment at: clang-tools-extra/clangd/Selection.cpp:733
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));
----------------
are we sure we want to print the range again on pop? Seems like on enter/skip is sufficient. It's useful to be able to visually distinguish push vs pop.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117475/new/
https://reviews.llvm.org/D117475
More information about the cfe-commits
mailing list