[PATCH] D117475: [clangd] NFC, emit source ranges in selection debug messages.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 19 06:39:57 PST 2022

hokein added inline comments.

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;
sammccall wrote:
> 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)
I inlined these two into one dlog, which makes the output more dense.

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));
sammccall wrote:
> 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.
oh, right, we don't need that. I think printing range on push is sufficient. 

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list