clang 20.0.0git
Classes | Protected Member Functions | Friends | List of all members
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:
Inheritance graph
[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

Definition at line 72 of file ConstantInitBuilder.h.

◆ ~ConstantInitBuilderBase()

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

Definition at line 74 of file ConstantInitBuilder.h.

Friends And Related Function Documentation

◆ ConstantAggregateBuilderBase

friend class ConstantAggregateBuilderBase
friend

Definition at line 67 of file ConstantInitBuilder.h.

◆ ConstantAggregateBuilderTemplateBase

template<class , class >
friend class ConstantAggregateBuilderTemplateBase
friend

Definition at line 69 of file ConstantInitBuilder.h.

◆ ConstantInitFuture

friend class ConstantInitFuture
friend

Definition at line 66 of file ConstantInitBuilder.h.


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