clang 22.0.0git
clang::CodeGen::ConstantInitBuilderBase Class Reference

A convenience builder class for complex constant initializers, especially for anonymous global structures used by various language runtimes. More...

#include "clang/CodeGen/ConstantInitBuilder.h"

Inheritance diagram for clang::CodeGen::ConstantInitBuilderBase:
[legend]

Protected Member Functions

 ConstantInitBuilderBase (CodeGenModule &CGM)
 ~ConstantInitBuilderBase ()

Friends

class ConstantInitFuture
class ConstantAggregateBuilderBase
template<class, class>
class ConstantAggregateBuilderTemplateBase

Detailed Description

A convenience builder class for complex constant initializers, especially for anonymous global structures used by various language runtimes.

The basic usage pattern is expected to be something like: ConstantInitBuilder builder(CGM); auto toplevel = builder.beginStruct(); toplevel.addInt(CGM.SizeTy, widgets.size()); auto widgetArray = builder.beginArray(); for (auto &widget : widgets) { auto widgetDesc = widgetArray.beginStruct(); widgetDesc.addInt(CGM.SizeTy, widget.getPower()); widgetDesc.add(CGM.GetAddrOfConstantStringFromLiteral(widget.getName())); widgetDesc.add(CGM.GetAddrOfGlobal(widget.getInitializerDecl())); widgetDesc.finishAndAddTo(widgetArray); } widgetArray.finishAndAddTo(toplevel); auto global = toplevel.finishAndCreateGlobal("WIDGET_LIST", Align, /*constant*‍/ true);

Definition at line 54 of file ConstantInitBuilder.h.

Constructor & Destructor Documentation

◆ ConstantInitBuilderBase()

clang::CodeGen::ConstantInitBuilderBase::ConstantInitBuilderBase ( CodeGenModule & CGM)
inlineexplicitprotected

◆ ~ConstantInitBuilderBase()

clang::CodeGen::ConstantInitBuilderBase::~ConstantInitBuilderBase ( )
inlineprotected

Definition at line 74 of file ConstantInitBuilder.h.

◆ ConstantAggregateBuilderBase

friend class ConstantAggregateBuilderBase
friend

Definition at line 67 of file ConstantInitBuilder.h.

References ConstantAggregateBuilderBase.

Referenced by ConstantAggregateBuilderBase.

◆ ConstantAggregateBuilderTemplateBase

template<class, class>
friend class ConstantAggregateBuilderTemplateBase
friend

◆ ConstantInitFuture

friend class ConstantInitFuture
friend

Definition at line 66 of file ConstantInitBuilder.h.

References ConstantInitFuture.

Referenced by ConstantInitFuture.


The documentation for this class was generated from the following files: