================ @@ -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) ---------------- andykaylor wrote:
I don't understand the question. This is inserting and using the result of the `insert()` to test whether it was already there before we tried to insert it. https://github.com/llvm/llvm-project/pull/136331 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits