================ @@ -86,10 +86,64 @@ 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; + policy.AlwaysIncludeTypeForTemplateArgument = true; + policy.PrintCanonicalTypes = true; + policy.SuppressTagKeyword = true; + + if (recordDecl->getIdentifier()) + astContext.getRecordType(recordDecl).print(outStream, policy); + else if (auto *typedefNameDecl = recordDecl->getTypedefNameForAnonDecl()) ---------------- erichkeane wrote:
Hmm... Note that `typedefs' (actually 'usings') can actually be templated (see https://clang.llvm.org/doxygen/classclang_1_1TypeAliasDecl.html). Can we have a test that makes sure we print template-args in that case? https://github.com/llvm/llvm-project/pull/135105 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits