[clang] [CIR] Upstream limited support for nested structures (PR #136331)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 18 11:06:21 PDT 2025
================
@@ -116,16 +116,93 @@ std::string CIRGenTypes::getRecordTypeName(const clang::RecordDecl *recordDecl,
return builder.getUniqueRecordName(std::string(typeName));
}
+/// Return true if the specified type is already completely laid out.
+bool CIRGenTypes::isRecordLayoutComplete(const Type *ty) const {
+ const auto it = recordDeclTypes.find(ty);
+ return it != recordDeclTypes.end() && it->second.isComplete();
+}
+
+// We have multiple forms of this function that call each other, so we need to
+// declare one in advance.
+static bool
+isSafeToConvert(QualType qt, CIRGenTypes &cgt,
+ llvm::SmallPtrSetImpl<const RecordDecl *> &alreadyChecked);
+
+/// Return true if it is safe to convert the specified record decl to CIR and
+/// lay it out, false if doing so would cause us to get into a recursive
+/// compilation mess.
+static bool
+isSafeToConvert(const RecordDecl *rd, CIRGenTypes &cgt,
+ llvm::SmallPtrSetImpl<const RecordDecl *> &alreadyChecked) {
+ // If we have already checked this type (maybe the same type is used by-value
+ // multiple times in multiple record fields, don't check again.
+ if (!alreadyChecked.insert(rd).second)
----------------
erichkeane wrote:
You shouldn't understand the question, it was a bad one.
https://github.com/llvm/llvm-project/pull/136331
More information about the cfe-commits
mailing list