[clang-tools-extra] e212a4f - [clangd] Don't print locations of anonymous tags
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 4 12:38:33 PDT 2022
Author: Sam McCall
Date: 2022-10-04T21:38:18+02:00
New Revision: e212a4f838f17e2d37b1d572d8c1b49c50d7fe17
URL: https://github.com/llvm/llvm-project/commit/e212a4f838f17e2d37b1d572d8c1b49c50d7fe17
DIFF: https://github.com/llvm/llvm-project/commit/e212a4f838f17e2d37b1d572d8c1b49c50d7fe17.diff
LOG: [clangd] Don't print locations of anonymous tags
These are usually not interesting when clangd presents results in
context, and the file paths are noisy.
Added:
Modified:
clang-tools-extra/clangd/AST.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index 31db4cf0f3cf5..a092b932e5216 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -189,6 +189,9 @@ std::string printQualifiedName(const NamedDecl &ND) {
// include them, but at query time it's hard to find all the inline
// namespaces to query: the preamble doesn't have a dedicated list.
Policy.SuppressUnwrittenScope = true;
+ // (unnamed struct), not (unnamed struct at /path/to/foo.cc:42:1).
+ // In clangd, context is usually available and paths are mostly noise.
+ Policy.AnonymousTagLocations = false;
ND.printQualifiedName(OS, Policy);
OS.flush();
assert(!StringRef(QName).startswith("::"));
More information about the cfe-commits
mailing list