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

Zixu Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 14:07:34 PDT 2022


zixuw added inline comments.


================
Comment at: clang/lib/ExtractAPI/DeclarationFragments.cpp:15
+#include "TypedefUnderlyingTypeResolver.h"
+
 #include "clang/ExtractAPI/DeclarationFragments.h"
----------------
Empty line


================
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)
----------------
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123019/new/

https://reviews.llvm.org/D123019



More information about the cfe-commits mailing list