Path: blob/main/contrib/llvm-project/clang/lib/CIR/CodeGen/CIRGenCXX.cpp
213799 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This contains code dealing with C++ code generation.9//10//===----------------------------------------------------------------------===//1112#include "CIRGenFunction.h"13#include "CIRGenModule.h"1415#include "clang/AST/GlobalDecl.h"16#include "clang/CIR/MissingFeatures.h"1718using namespace clang;19using namespace clang::CIRGen;2021cir::FuncOp CIRGenModule::codegenCXXStructor(GlobalDecl gd) {22const CIRGenFunctionInfo &fnInfo =23getTypes().arrangeCXXStructorDeclaration(gd);24cir::FuncType funcType = getTypes().getFunctionType(fnInfo);25cir::FuncOp fn = getAddrOfCXXStructor(gd, &fnInfo, /*FnType=*/nullptr,26/*DontDefer=*/true, ForDefinition);27setFunctionLinkage(gd, fn);28CIRGenFunction cgf{*this, builder};29curCGF = &cgf;30{31mlir::OpBuilder::InsertionGuard guard(builder);32cgf.generateCode(gd, fn, funcType);33}34curCGF = nullptr;3536setNonAliasAttributes(gd, fn);37assert(!cir::MissingFeatures::opFuncAttributesForDefinition());38return fn;39}404142