diff options
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenModule.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 8407f8f..434dd37 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -226,11 +226,9 @@ mlir::Operation * CIRGenModule::getAddrOfGlobal(GlobalDecl gd, ForDefinition_t isForDefinition) { const Decl *d = gd.getDecl(); - if (isa<CXXConstructorDecl>(d) || isa<CXXDestructorDecl>(d)) { - errorNYI(d->getSourceRange(), - "getAddrOfGlobal: C++ constructor/destructor"); - return nullptr; - } + if (isa<CXXConstructorDecl>(d) || isa<CXXDestructorDecl>(d)) + return getAddrOfCXXStructor(gd, /*FnInfo=*/nullptr, /*FnType=*/nullptr, + /*DontDefer=*/false, isForDefinition); if (isa<CXXMethodDecl>(d)) { const CIRGenFunctionInfo &fi = @@ -411,6 +409,7 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd, cgf.generateCode(gd, funcOp, funcType); } curCGF = nullptr; + assert(!cir::MissingFeatures::opFuncAttributesForDefinition()); } mlir::Operation *CIRGenModule::getGlobalValue(StringRef name) { @@ -771,7 +770,7 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd, // Make sure to emit the definition(s) before we emit the thunks. This is // necessary for the generation of certain thunks. if (isa<CXXConstructorDecl>(method) || isa<CXXDestructorDecl>(method)) - errorNYI(method->getSourceRange(), "C++ ctor/dtor"); + abi->emitCXXStructor(gd); else if (fd->isMultiVersion()) errorNYI(method->getSourceRange(), "multiversion functions"); else @@ -1173,6 +1172,10 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) { case Decl::Empty: break; + case Decl::CXXConstructor: + getCXXABI().emitCXXConstructors(cast<CXXConstructorDecl>(decl)); + break; + // C++ Decls case Decl::LinkageSpec: case Decl::Namespace: |