[clang] [CIR] Upstream minimal support for structure types (PR #135105)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 10 12:17:44 PDT 2025
================
@@ -86,10 +86,80 @@ mlir::Type CIRGenTypes::convertFunctionTypeInternal(QualType qft) {
return cir::FuncType::get(SmallVector<mlir::Type, 1>{}, cgm.VoidTy);
}
+// This is CIR's version of CodeGenTypes::addRecordTypeName. It isn't shareable
+// because CIR has different uniquing requirements.
+std::string CIRGenTypes::getRecordTypeName(const clang::RecordDecl *recordDecl,
+ StringRef suffix) {
+ llvm::SmallString<256> typeName;
+ llvm::raw_svector_ostream outStream(typeName);
+
+ PrintingPolicy policy = recordDecl->getASTContext().getPrintingPolicy();
+ policy.SuppressInlineNamespace = false;
+
+ if (recordDecl->getIdentifier()) {
+ if (recordDecl->getDeclContext())
----------------
andykaylor wrote:
The only thing I can figure is that someone saw that `printQualifiedName` dereferences the DeclContext pointer and thought a safeguard was needed. I can remove this.
https://github.com/llvm/llvm-project/pull/135105
More information about the cfe-commits
mailing list