Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/clang/lib/CIR/CodeGen/CIRGenCXX.cpp
213799 views
1
//===----------------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This contains code dealing with C++ code generation.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "CIRGenFunction.h"
14
#include "CIRGenModule.h"
15
16
#include "clang/AST/GlobalDecl.h"
17
#include "clang/CIR/MissingFeatures.h"
18
19
using namespace clang;
20
using namespace clang::CIRGen;
21
22
cir::FuncOp CIRGenModule::codegenCXXStructor(GlobalDecl gd) {
23
const CIRGenFunctionInfo &fnInfo =
24
getTypes().arrangeCXXStructorDeclaration(gd);
25
cir::FuncType funcType = getTypes().getFunctionType(fnInfo);
26
cir::FuncOp fn = getAddrOfCXXStructor(gd, &fnInfo, /*FnType=*/nullptr,
27
/*DontDefer=*/true, ForDefinition);
28
setFunctionLinkage(gd, fn);
29
CIRGenFunction cgf{*this, builder};
30
curCGF = &cgf;
31
{
32
mlir::OpBuilder::InsertionGuard guard(builder);
33
cgf.generateCode(gd, fn, funcType);
34
}
35
curCGF = nullptr;
36
37
setNonAliasAttributes(gd, fn);
38
assert(!cir::MissingFeatures::opFuncAttributesForDefinition());
39
return fn;
40
}
41
42