[clang-tools-extra] 55b702c - [clangd] NFC, emit source ranges in selection debug messages.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 19 07:07:30 PST 2022
Author: Haojian Wu
Date: 2022-01-19T16:06:58+01:00
New Revision: 55b702c37b7e8b5fde04b6a60b5bb12806bdb697
URL: https://github.com/llvm/llvm-project/commit/55b702c37b7e8b5fde04b6a60b5bb12806bdb697
DIFF: https://github.com/llvm/llvm-project/commit/55b702c37b7e8b5fde04b6a60b5bb12806bdb697.diff
LOG: [clangd] NFC, emit source ranges in selection debug messages.
It will make the output more versbose, but I found that these are useful
information when debugging selection tree.
Differential Revision: https://reviews.llvm.org/D117475
Added:
Modified:
clang-tools-extra/clangd/Selection.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index cc698631be03..6dfaa8be9591 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -548,7 +548,6 @@ std::string printNodeToString(const DynTypedNode &N, const PrintingPolicy &PP) {
std::string S;
llvm::raw_string_ostream OS(S);
printNodeKind(OS, N);
- OS << " ";
return std::move(OS.str());
}
#endif
@@ -778,8 +777,8 @@ class SelectionVisitor : public RecursiveASTVisitor<SelectionVisitor> {
[](const Attr *A) { return !A->isImplicit(); }))
return false;
if (!SelChecker.mayHit(S)) {
- dlog("{1}skip: {0}", printNodeToString(N, PrintPolicy), indent());
- dlog("{1}skipped range = {0}", S.printToString(SM), indent(1));
+ dlog("{2}skip: {0} {1}", printNodeToString(N, PrintPolicy),
+ S.printToString(SM), indent());
return true;
}
return false;
@@ -798,7 +797,8 @@ class SelectionVisitor : public RecursiveASTVisitor<SelectionVisitor> {
// Performs early hit detection for some nodes (on the earlySourceRange).
void push(DynTypedNode Node) {
SourceRange Early = earlySourceRange(Node);
- dlog("{1}push: {0}", printNodeToString(Node, PrintPolicy), indent());
+ dlog("{2}push: {0} {1}", printNodeToString(Node, PrintPolicy),
+ Node.getSourceRange().printToString(SM), indent());
Nodes.emplace_back();
Nodes.back().ASTNode = std::move(Node);
Nodes.back().Parent = Stack.top();
More information about the cfe-commits
mailing list