[PATCH] D123019: [clang][extract-api] Add support for typedefs

Daniel Grumberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 03:48:57 PDT 2022

dang added inline comments.

Comment at: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp:598-605
+  // Typedefs of anonymous types have their entries unified with the underlying
+  // type.
+  bool ShouldDrop = Record.UnderlyingType.Name.empty();
+  // enums declared with `NS_OPTION` have a named enum and a named typedef, with
+  // the same name
+  ShouldDrop |= (Record.UnderlyingType.Name == Record.Name);
+  if (ShouldDrop)
zixuw wrote:
> Consider move the should-drop logic into `SymbolGraphSerializer::shouldSkip(const APIRecord &Record) const` so that we have a central place to see and manage which symbols get skipped.
> This would also simplify things here as the filtering will automatically get handled in the following `serializeAPIRecord(Record)` line.
I need to know about it being a `TypedefRecord` so I can access the underlying type name, so I would need to attempt to `dyn_cast` in `shouldSkip`. Also this logic is specific to typedef records so I would prefer to keep it here.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list