clang 24.0.0git
CIRGenExprConstant.cpp File Reference
#include "Address.h"
#include "CIRGenCXXABI.h"
#include "CIRGenConstantEmitter.h"
#include "CIRGenModule.h"
#include "CIRGenRecordLayout.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinAttributeInterfaces.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/Builtins.h"
#include "clang/CIR/Dialect/IR/CIRAttrs.h"
#include "clang/CIR/Dialect/IR/CIRTypes.h"
#include "clang/CIR/MissingFeatures.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ErrorHandling.h"
#include <functional>
#include <iterator>
#include <optional>

Go to the source code of this file.

Namespaces

namespace  ConstRecordBuilder

Functions

static bool collectStoredInitializers (CIRGenBuilderTy &builder, cir::RecordType recordTy, llvm::ArrayRef< mlir::Attribute > elements, llvm::SmallVectorImpl< mlir::Attribute > &stored)
 Collects the initializer elements for the members of recordTy that are stored, in order, taking a zero initializer for any member left unset.
static cir::GlobalViewAttr tryEmitGlobalCompoundLiteral (ConstantEmitter &emitter, const CompoundLiteralExpr *e)
static mlir::TypedAttr emitNullConstantForBase (CIRGenModule &cgm, mlir::Type baseType, const CXXRecordDecl *baseDecl)
 Emit the null constant for a base subobject.
static mlir::TypedAttr emitNullConstant (CIRGenModule &cgm, const RecordDecl *rd, bool asCompleteObject)

Function Documentation

◆ collectStoredInitializers()

bool collectStoredInitializers ( CIRGenBuilderTy & builder,
cir::RecordType recordTy,
llvm::ArrayRef< mlir::Attribute > elements,
llvm::SmallVectorImpl< mlir::Attribute > & stored )
static

Collects the initializer elements for the members of recordTy that are stored, in order, taking a zero initializer for any member left unset.

elements is indexed by member, which is not the same as being indexed by stored element. A zero-width bit-field owns no bytes and so takes no element at all. Fails if a member has no zero initializer.

Definition at line 48 of file CIRGenExprConstant.cpp.

References cir::RecordType::getMembers(), cir::CIRBaseBuilderTy::getZeroInitAttr(), and cir::memberOwnsBytes().

Referenced by emitNullConstant().

◆ emitNullConstant()

◆ emitNullConstantForBase()

mlir::TypedAttr emitNullConstantForBase ( CIRGenModule & cgm,
mlir::Type baseType,
const CXXRecordDecl * baseDecl )
static

◆ tryEmitGlobalCompoundLiteral()