[PATCH] D83992: [ASTImporter] Add Visitor for TypedefNameDecl's

Vince Bridgers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 16:40:45 PDT 2020


vabridgers updated this revision to Diff 278630.
vabridgers added a comment.

Fix lint pre-merge check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83992

Files:
  clang/lib/AST/ASTImporterLookupTable.cpp


Index: clang/lib/AST/ASTImporterLookupTable.cpp
===================================================================
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -22,6 +22,20 @@
 struct Builder : RecursiveASTVisitor<Builder> {
   ASTImporterLookupTable <
   Builder(ASTImporterLookupTable &LT) : LT(LT) {}
+
+  bool VisitTypedefNameDecl(TypedefNameDecl *D) {
+    QualType Ty = D->getUnderlyingType();
+    Ty = Ty.getCanonicalType();
+    if (const auto *RTy = dyn_cast<RecordType>(Ty)) {
+      LT.add(RTy->getAsRecordDecl());
+      // iterate over the field decls, adding them
+      for (auto *it : RTy->getAsRecordDecl()->fields()) {
+        LT.add(it);
+      }
+    }
+    return true;
+  }
+
   bool VisitNamedDecl(NamedDecl *D) {
     LT.add(D);
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83992.278630.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200716/298de319/attachment-0001.bin>


More information about the cfe-commits mailing list