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

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 02:09:12 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();
----------------
hokein wrote:

There is a FIXME on L68 (cannot make a comment on the unmodified line in GitHub), it is probably stale, just removing it?

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


More information about the cfe-commits mailing list