[clang-tools-extra] [clangd] Improve filtering logic for undesired proto symbols (PR #110091)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 02:25:34 PDT 2024


================
@@ -75,18 +76,61 @@ bool isPrivateProtoDecl(const NamedDecl &ND) {
   if (ND.getIdentifier() == nullptr)
     return false;
   auto Name = ND.getIdentifier()->getName();
-  if (!Name.contains('_'))
-    return false;
-  // Nested proto entities (e.g. Message::Nested) have top-level decls
-  // that shouldn't be used (Message_Nested). Ignore them completely.
-  // The nested entities are dangling type aliases, we may want to reconsider
-  // including them in the future.
-  // For enum constants, SOME_ENUM_CONSTANT is not private and should be
-  // indexed. Outer_INNER is private. This heuristic relies on naming style, it
-  // will include OUTER_INNER and exclude some_enum_constant.
-  // FIXME: the heuristic relies on naming style (i.e. no underscore in
-  // user-defined names) and can be improved.
-  return (ND.getKind() != Decl::EnumConstant) || llvm::any_of(Name, islower);
+  // There are some internal helpers like _internal_set_foo();
----------------
kadircet wrote:

I feel like that FIXME might still apply. I think it's rather about passing in a custom filter, similar to `FileFilter`, so I am more inclined towards keeping it

https://github.com/llvm/llvm-project/pull/110091


More information about the cfe-commits mailing list