Import simple structs

In this CL we generate bindings for trivial structs, assuming among other things:
* the struct is trivially movable
* all its members are exclusively non-static member variables
* all non-static member variable are public and directly accesible

We're adding TODOs to handle these and other assumptions in the future. The goal of this CL is to add enough behavior into the generator so we can experiment with more principled Type representations in the IR.

PiperOrigin-RevId: 396815320
diff --git a/rs_bindings_from_cc/ast_visitor.cc b/rs_bindings_from_cc/ast_visitor.cc
index d881093..f174dcd 100644
--- a/rs_bindings_from_cc/ast_visitor.cc
+++ b/rs_bindings_from_cc/ast_visitor.cc
@@ -16,6 +16,7 @@
 #include "third_party/llvm/llvm-project/clang/include/clang/AST/Decl.h"
 #include "third_party/llvm/llvm-project/clang/include/clang/AST/Mangle.h"
 #include "third_party/llvm/llvm-project/clang/include/clang/AST/Type.h"
+#include "third_party/llvm/llvm-project/llvm/include/llvm/Support/Casting.h"
 
 namespace rs_bindings_from_cc {
 
@@ -78,6 +79,34 @@
   return true;
 }
 
+bool AstVisitor::VisitRecordDecl(clang::RecordDecl* record_decl) {
+  // TODO(hlopko): Check access control for members
+  // TODO(hlopko): Import nested types
+  // TODO(hlopko): Import methods
+  // TODO(hlopko): Import constructors
+  // TODO(hlopko): Import destructor
+  // TODO(hlopko): Import operators
+  // TODO(hlopko): Handle class template specializations
+  // TODO(hlopko): Handle partial class template specializations
+  // TODO(hlopko): Handle unions
+  // TODO(hlopko): Handle non-trivially movable types
+  // TODO(hlopko): Make trivially copyable types copyable in Rust too
+  // TODO(hlopko): Handle dependent types
+  // TODO(hlopko): Handle opaque types (for example types with a field we cannot
+  // yet import)
+  // TODO(hlopko): Handle named bitfields
+  // TODO(hlopko): Handle unnamed bitfields (used only for padding)
+  // TODO(hlopko): Collect and cross check field offsets in C++ and in Rust
+
+  std::vector<Field> fields;
+  for (const clang::FieldDecl* field_decl : record_decl->fields()) {
+    fields.emplace_back(GetTranslatedName(field_decl),
+                        ConvertType(field_decl->getType()));
+  }
+  ir_.Records().emplace_back(GetTranslatedName(record_decl), std::move(fields));
+  return true;
+}
+
 Type AstVisitor::ConvertType(clang::QualType qual_type) const {
   // TODO(hlopko): Handle all builtin types
   // TODO(hlopko): Handle user-defined types