Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
clang::insights::CodeGenerator Class Reference

More or less the heart of C++ Insights. More...

#include "CodeGenerator.h"

Inheritance diagram for clang::insights::CodeGenerator:
Inheritance graph
[legend]
Collaboration diagram for clang::insights::CodeGenerator:
Collaboration graph
[legend]

Classes

class  LambdaHelper
 
class  LambdaScopeHandler
 

Public Member Functions

constexpr CodeGenerator (OutputFormatHelper &_outputFormatHelper)
 
constexpr CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaInInitCapture lambdaInitCapture)
 
constexpr CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaStackType &lambdaStack, ProcessingPrimaryTemplate processingPrimaryTemplate)
 
virtual ~CodeGenerator ()=default
 
virtual void InsertArg (const Decl *stmt)
 
virtual void InsertArg (const Stmt *stmt)
 
template<typename T >
void InsertTemplateArgs (const T &t)
 
void InsertTemplateArgs (const ClassTemplateSpecializationDecl &clsTemplateSpe)
 
void InsertFunctionNameWithReturnType (const FunctionDecl &decl, const CXXConstructorDecl *cxxInheritedCtorDecl=nullptr)
 Insert the code for a FunctionDecl. More...
 
template<typename T >
void InsertTemplateArgs (const ArrayRef< T > &array)
 
void InsertAttributes (const Decl *)
 
void InsertAttributes (const Decl::attr_range &)
 
void InsertAttribute (const Attr &)
 
void InsertTemplateArg (const TemplateArgument &arg)
 
 STRONG_BOOL (TemplateParamsOnly)
 
void InsertTemplateParameters (const TemplateParameterList &list, const TemplateParamsOnly templateParamsOnly=TemplateParamsOnly::No)
 ! Skip template, type constraints and class/typename. More...
 
void StartLifetimeScope ()
 
void LifetimeAddExtended (const VarDecl *, const ValueDecl *)
 
void EndLifetimeScope ()
 

Public Attributes

const Decl * mLastDecl {}
 

Protected Types

enum class  LambdaCallerType {
  VarDecl , InitCapture , CallExpr , OperatorCallExpr ,
  MemberCallExpr , LambdaExpr , ReturnStmt , BinaryOperator ,
  CXXMethodDecl , TemplateHead , Decltype
}
 
enum class  BraceKind { Parens , Curlys }
 
using LambdaStackType = StackList< class LambdaHelper >
 

Protected Member Functions

 STRONG_BOOL (LambdaInInitCapture)
 
 STRONG_BOOL (ProcessingPrimaryTemplate)
 
constexpr CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaStackType &lambdaStack, LambdaInInitCapture lambdaInitCapture, ProcessingPrimaryTemplate processingPrimaryTemplate)
 ! We do not want to transform a primary template which contains a Coroutine. More...
 
virtual bool InsertVarDecl (const VarDecl *)
 
virtual bool SkipSpaceAfterVarDecl ()
 
virtual bool InsertComma ()
 
virtual bool InsertSemi ()
 
virtual bool InsertNamespace () const
 
virtual bool ShowXValueCasts () const
 Show casts to xvalues independent from the show all casts option. More...
 
void HandleTemplateParameterPack (const ArrayRef< TemplateArgument > &args)
 
void HandleCompoundStmt (const CompoundStmt *stmt)
 
void HandleLocalStaticNonTrivialClass (const VarDecl *stmt)
 Show what is behind a local static variable. More...
 
virtual void FormatCast (const std::string_view castName, const QualType &CastDestType, const Expr *SubExpr, const CastKind &castKind)
 
void ForEachArg (const auto &arguments, auto &&lambda)
 
void InsertArgWithParensIfNeeded (const Stmt *stmt)
 
void InsertSuffix (const QualType &type)
 
void InsertTemplateArg (const TemplateArgumentLoc &arg)
 
bool InsertLambdaStaticInvoker (const CXXMethodDecl *cxxMethodDecl)
 
 STRONG_BOOL (InsertInline)
 
void InsertConceptConstraint (const llvm::SmallVectorImpl< const Expr * > &constraints, const InsertInline insertInline)
 
void InsertConceptConstraint (const FunctionDecl *tmplDecl)
 
void InsertConceptConstraint (const VarDecl *varDecl)
 
void InsertConceptConstraint (const TemplateParameterList &tmplDecl)
 
void InsertTemplate (const FunctionTemplateDecl *, bool withSpec)
 
void InsertQualifierAndNameWithTemplateArgs (const DeclarationName &declName, const auto *stmt)
 
void InsertQualifierAndName (const DeclarationName &declName, const NestedNameSpecifier *qualifier, const bool hasTemplateKeyword)
 
void InsertCXXMethodHeader (const CXXMethodDecl *stmt, OutputFormatHelper &initOutputFormatHelper)
 
void InsertTemplateGuardBegin (const FunctionDecl *stmt)
 
void InsertTemplateGuardEnd (const FunctionDecl *stmt)
 
void InsertTemplateSpecializationHeader (const Decl &)
 Insert template<> to introduce a template specialization. More...
 
void InsertTemplateArgsObjectParam (const ArrayRef< TemplateArgument > &array)
 
void InsertTemplateArgsObjectParam (const TemplateParamObjectDecl &param)
 
void InsertNamespace (const NestedNameSpecifier *namespaceSpecifier)
 
void ParseDeclContext (const DeclContext *Ctx)
 
 STRONG_BOOL (SkipBody)
 
virtual void InsertCXXMethodDecl (const CXXMethodDecl *stmt, SkipBody skipBody)
 
void InsertMethodBody (const FunctionDecl *stmt, const size_t posBeforeFunc)
 
template<typename T >
void InsertConstructorExpr (const T *stmt)
 Generalized function to insert either a CXXConstructExpr or CXXUnresolvedConstructExpr. More...
 
void InsertCurlysIfRequired (const Stmt *stmt)
 Check whether or not this statement will add curlys or parentheses and add them only if required. More...
 
void InsertIfOrSwitchInitVariables (same_as_any_of< const IfStmt, const SwitchStmt > auto *stmt)
 
void InsertInstantiationPoint (const SourceManager &sm, const SourceLocation &instLoc, std::string_view text={})
 Inserts the instantiation point of a template. More...
 
 STRONG_BOOL (AddNewLineAfter)
 
void WrapInCompoundIfNeeded (const Stmt *stmt, const AddNewLineAfter addNewLineAfter)
 
 STRONG_BOOL (AddSpaceAtTheEnd)
 
void WrapInParens (void_func_ref lambda, const AddSpaceAtTheEnd addSpaceAtTheEnd=AddSpaceAtTheEnd::No)
 
void WrapInParensIfNeeded (bool needsParens, void_func_ref lambda, const AddSpaceAtTheEnd addSpaceAtTheEnd=AddSpaceAtTheEnd::No)
 
void WrapInCurliesIfNeeded (bool needsParens, void_func_ref lambda, const AddSpaceAtTheEnd addSpaceAtTheEnd=AddSpaceAtTheEnd::No)
 
void WrapInCurlys (void_func_ref lambda, const AddSpaceAtTheEnd addSpaceAtTheEnd=AddSpaceAtTheEnd::No)
 
void WrapInParensOrCurlys (const BraceKind curlys, void_func_ref lambda, const AddSpaceAtTheEnd addSpaceAtTheEnd=AddSpaceAtTheEnd::No)
 
void UpdateCurrentPos (std::optional< size_t > &pos)
 
void HandleLambdaExpr (const LambdaExpr *stmt, LambdaHelper &lambdaHelper)
 
bool InsideDecltype () const
 
 STRONG_BOOL (SkipVarDecl)
 
 STRONG_BOOL (UseCommaInsteadOfSemi)
 
 STRONG_BOOL (NoEmptyInitList)
 
 STRONG_BOOL (ShowConstantExprValue)
 

Static Protected Member Functions

static std::string_view GetBuiltinTypeSuffix (const BuiltinType::Kind &kind)
 
static std::string FillConstantArray (const ConstantArrayType *ct, const std::string &value, const uint64_t startAt)
 
static std::string GetValueOfValueInit (const QualType &t)
 

Protected Attributes

LifetimeTracker mLifeTimeTracker {}
 
const StmtmLastStmt {}
 
const Expr * mLastExpr {}
 
bool mProcessingVarDecl {}
 
OutputFormatHelpermOutputFormatHelper
 
LambdaStackType mLambdaStackThis
 
LambdaStackTypemLambdaStack
 
LambdaInInitCapture mLambdaInitCapture {LambdaInInitCapture::No}
 
ShowConstantExprValue mShowConstantExprValue {ShowConstantExprValue::No}
 
SkipVarDecl mSkipVarDecl {SkipVarDecl::No}
 
UseCommaInsteadOfSemi mUseCommaInsteadOfSemi {UseCommaInsteadOfSemi::No}
 
NoEmptyInitList mNoEmptyInitList
 At least in case if a requires-clause containing T{} we don't want to get T{{}}. More...
 
const LambdaExpr * mLambdaExpr {}
 
std::optional< size_t > mCurrentVarDeclPos {}
 
std::optional< size_t > mCurrentCallExprPos {}
 
std::optional< size_t > mCurrentReturnPos {}
 
std::optional< size_t > mCurrentFieldPos {}
 
OutputFormatHelpermOutputFormatHelperOutside
 Helper output buffer for std::initializer_list expansion. More...
 
bool mRequiresImplicitReturnZero {}
 Track whether this is a function with an imlpicit return 0. More...
 
bool mSkipSemi {}
 
ProcessingPrimaryTemplate mProcessingPrimaryTemplate {}
 

Static Protected Attributes

static constexpr auto MAX_FILL_VALUES_FOR_ARRAYS
 
static std::map< std::string, bool > mSeenDecls {}
 

Friends

class CodeGeneratorVariant
 

Detailed Description

More or less the heart of C++ Insights.

This is the place where nearly all of the transformations happen. This class knows the needed types and how to generated code from them.

Definition at line 90 of file CodeGenerator.h.

Member Typedef Documentation

◆ LambdaStackType

Definition at line 166 of file CodeGenerator.h.

Member Enumeration Documentation

◆ BraceKind

Enumerator
Parens 
Curlys 

Definition at line 381 of file CodeGenerator.h.

◆ LambdaCallerType

Enumerator
VarDecl 
InitCapture 
CallExpr 
OperatorCallExpr 
MemberCallExpr 
LambdaExpr 
ReturnStmt 
BinaryOperator 
CXXMethodDecl 
TemplateHead 
Decltype 

Definition at line 106 of file CodeGenerator.h.

Constructor & Destructor Documentation

◆ CodeGenerator() [1/4]

constexpr clang::insights::CodeGenerator::CodeGenerator ( OutputFormatHelper _outputFormatHelper,
LambdaStackType lambdaStack,
LambdaInInitCapture  lambdaInitCapture,
ProcessingPrimaryTemplate  processingPrimaryTemplate 
)
inlineconstexprprotected

! We do not want to transform a primary template which contains a Coroutine.

Definition at line 174 of file CodeGenerator.h.

◆ CodeGenerator() [2/4]

constexpr clang::insights::CodeGenerator::CodeGenerator ( OutputFormatHelper _outputFormatHelper)
inlineexplicitconstexpr

Definition at line 186 of file CodeGenerator.h.

◆ CodeGenerator() [3/4]

constexpr clang::insights::CodeGenerator::CodeGenerator ( OutputFormatHelper _outputFormatHelper,
LambdaInInitCapture  lambdaInitCapture 
)
inlineconstexpr

Definition at line 191 of file CodeGenerator.h.

◆ CodeGenerator() [4/4]

constexpr clang::insights::CodeGenerator::CodeGenerator ( OutputFormatHelper _outputFormatHelper,
LambdaStackType lambdaStack,
ProcessingPrimaryTemplate  processingPrimaryTemplate 
)
inlineconstexpr

Definition at line 196 of file CodeGenerator.h.

◆ ~CodeGenerator()

virtual clang::insights::CodeGenerator::~CodeGenerator ( )
virtualdefault

Member Function Documentation

◆ EndLifetimeScope()

void clang::insights::CodeGenerator::EndLifetimeScope ( )

◆ FillConstantArray()

std::string clang::insights::CodeGenerator::FillConstantArray ( const ConstantArrayType *  ct,
const std::string &  value,
const uint64_t  startAt 
)
staticprotected

Fill the values of a constant array.

This is either called by InitListExpr (which may contain an offset, as the user already provided certain values) or by GetValueOfValueInit.

Definition at line 1918 of file CodeGenerator.cpp.

References clang::insights::for_each(), clang::insights::GetSize(), and MAX_FILL_VALUES_FOR_ARRAYS.

◆ ForEachArg()

void clang::insights::CodeGenerator::ForEachArg ( const auto &  arguments,
auto &&  lambda 
)
inlineprotected

◆ FormatCast()

void clang::insights::CodeGenerator::FormatCast ( const std::string_view  castName,
const QualType &  CastDestType,
const Expr *  SubExpr,
const CastKind &  castKind 
)
protectedvirtual

◆ GetBuiltinTypeSuffix()

std::string_view clang::insights::CodeGenerator::GetBuiltinTypeSuffix ( const BuiltinType::Kind &  kind)
staticprotected

Definition at line 4709 of file CodeGenerator.cpp.

References CASE.

◆ GetValueOfValueInit()

std::string clang::insights::CodeGenerator::GetValueOfValueInit ( const QualType &  t)
staticprotected

Definition at line 2975 of file CodeGenerator.cpp.

References clang::insights::Error(), kwFalse, and kwNullptr.

◆ HandleCompoundStmt()

void clang::insights::CodeGenerator::HandleCompoundStmt ( const CompoundStmt *  stmt)
protected

Definition at line 2453 of file CodeGenerator.cpp.

References clang::insights::IsStmtRequiringSemi().

◆ HandleLambdaExpr()

void clang::insights::CodeGenerator::HandleLambdaExpr ( const LambdaExpr *  stmt,
LambdaHelper lambdaHelper 
)
protected

◆ HandleLocalStaticNonTrivialClass()

void clang::insights::CodeGenerator::HandleLocalStaticNonTrivialClass ( const VarDecl *  stmt)
protected

◆ HandleTemplateParameterPack()

void clang::insights::CodeGenerator::HandleTemplateParameterPack ( const ArrayRef< TemplateArgument > &  args)
protected

Definition at line 4541 of file CodeGenerator.cpp.

◆ InsertArg() [1/2]

void clang::insights::CodeGenerator::InsertArg ( const Decl *  stmt)
virtual

◆ InsertArg() [2/2]

void clang::insights::CodeGenerator::InsertArg ( const Stmt stmt)
virtual

Definition at line 4464 of file CodeGenerator.cpp.

References clang::insights::DPrint(), and clang::insights::ToDo().

◆ InsertArgWithParensIfNeeded()

void clang::insights::CodeGenerator::InsertArgWithParensIfNeeded ( const Stmt stmt)
protected

Definition at line 4503 of file CodeGenerator.cpp.

◆ InsertAttribute()

void clang::insights::CodeGenerator::InsertAttribute ( const Attr &  attr)

◆ InsertAttributes() [1/2]

void clang::insights::CodeGenerator::InsertAttributes ( const Decl *  stmt)

◆ InsertAttributes() [2/2]

void clang::insights::CodeGenerator::InsertAttributes ( const Decl::attr_range &  attrs)

Definition at line 3738 of file CodeGenerator.cpp.

◆ InsertComma()

virtual bool clang::insights::CodeGenerator::InsertComma ( )
inlineprotectedvirtual

Reimplemented in clang::insights::MultiStmtDeclCodeGenerator.

Definition at line 286 of file CodeGenerator.h.

◆ InsertConceptConstraint() [1/4]

void clang::insights::CodeGenerator::InsertConceptConstraint ( const FunctionDecl *  tmplDecl)
protected

Definition at line 4772 of file CodeGenerator.cpp.

◆ InsertConceptConstraint() [2/4]

void clang::insights::CodeGenerator::InsertConceptConstraint ( const llvm::SmallVectorImpl< const Expr * > &  constraints,
const InsertInline  insertInline 
)
protected

Definition at line 4742 of file CodeGenerator.cpp.

References kwRequiresSpace.

Referenced by InsertTemplateParameters().

◆ InsertConceptConstraint() [3/4]

void clang::insights::CodeGenerator::InsertConceptConstraint ( const TemplateParameterList &  tmplDecl)
protected

Definition at line 4761 of file CodeGenerator.cpp.

◆ InsertConceptConstraint() [4/4]

void clang::insights::CodeGenerator::InsertConceptConstraint ( const VarDecl *  varDecl)
protected

Definition at line 4782 of file CodeGenerator.cpp.

References kwCCommentEndSpace, and kwCommentStart.

◆ InsertConstructorExpr()

template<typename T >
void clang::insights::CodeGenerator::InsertConstructorExpr ( const T *  stmt)
protected

Generalized function to insert either a CXXConstructExpr or CXXUnresolvedConstructExpr.

Definition at line 2002 of file CodeGenerator.cpp.

References CONDITIONAL_LAMBDA_SCOPE_HELPER, clang::insights::details::GetName(), RETURN_IF, and clang::insights::ValueOr().

◆ InsertCurlysIfRequired()

void clang::insights::CodeGenerator::InsertCurlysIfRequired ( const Stmt stmt)
protected

Check whether or not this statement will add curlys or parentheses and add them only if required.

Definition at line 5044 of file CodeGenerator.cpp.

Referenced by InsertCXXMethodHeader().

◆ InsertCXXMethodDecl()

void clang::insights::CodeGenerator::InsertCXXMethodDecl ( const CXXMethodDecl *  stmt,
SkipBody  skipBody 
)
protectedvirtual

◆ InsertCXXMethodHeader()

void clang::insights::CodeGenerator::InsertCXXMethodHeader ( const CXXMethodDecl *  stmt,
OutputFormatHelper initOutputFormatHelper 
)
protected

◆ InsertFunctionNameWithReturnType()

void clang::insights::CodeGenerator::InsertFunctionNameWithReturnType ( const FunctionDecl &  decl,
const CXXConstructorDecl *  cxxInheritedCtorDecl = nullptr 
)

Insert the code for a FunctionDecl.

This inserts the code of a FunctionDecl (and everything which is derived from one). It takes care of CXXMethodDecl's access modifier as well as things like constexpr, noexcept, static and more.

Parameters
declThe FunctionDecl to process.
skipAccessShow or hide access modifiers (public, private, protected). The default is to show them.
cxxInheritedCtorDeclIf not null, the type and name of this decl is used for the parameters.

Definition at line 4794 of file CodeGenerator.cpp.

References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendParameterList(), clang::insights::BuildRetTypeName(), clang::insights::GetConst(), clang::insights::GetDesugarReturnType(), GetInsightsOptions(), clang::insights::details::GetName(), clang::insights::GetNoExcept(), clang::insights::GetStorageClassAsStringWithSpace(), clang::insights::OutputFormatHelper::GetString(), clang::insights::GetType(), clang::insights::GetTypeNameAsParameter(), hlpAssing, InsertTemplateArgs(), clang::insights::IsStaticStorageClass(), kwCCommentEndSpace, kwCommentStart, kwConstEvalSpace, kwConstExprSpace, kwCppCommentStartSpace, kwExplicit, kwExplicitSpace, kwFriendSpace, kwInlineSpace, kwOperatorSpace, kwSpaceEqualsDefault, kwSpaceEqualsDelete, kwSpaceFinal, kwSpaceVolatile, kwStaticSpace, kwUsingSpace, and kwVirtualSpace.

◆ InsertIfOrSwitchInitVariables()

void clang::insights::CodeGenerator::InsertIfOrSwitchInitVariables ( same_as_any_of< const IfStmt, const SwitchStmt > auto *  stmt)
protected

Definition at line 2481 of file CodeGenerator.cpp.

◆ InsertInstantiationPoint()

void clang::insights::CodeGenerator::InsertInstantiationPoint ( const SourceManager &  sm,
const SourceLocation &  instLoc,
std::string_view  text = {} 
)
protected

Inserts the instantiation point of a template.

Definition at line 1531 of file CodeGenerator.cpp.

References clang::insights::OutputFormatHelper::AppendCommentNewLine(), and mOutputFormatHelper.

Referenced by clang::insights::CoroutinesCodeGenerator::InsertArg(), and InsertTemplateGuardBegin().

◆ InsertLambdaStaticInvoker()

bool clang::insights::CodeGenerator::InsertLambdaStaticInvoker ( const CXXMethodDecl *  cxxMethodDecl)
protected

◆ InsertMethodBody()

void clang::insights::CodeGenerator::InsertMethodBody ( const FunctionDecl *  stmt,
const size_t  posBeforeFunc 
)
protected

◆ InsertNamespace() [1/2]

virtual bool clang::insights::CodeGenerator::InsertNamespace ( ) const
inlineprotectedvirtual

Reimplemented in clang::insights::UsingCodeGenerator.

Definition at line 288 of file CodeGenerator.h.

◆ InsertNamespace() [2/2]

void clang::insights::CodeGenerator::InsertNamespace ( const NestedNameSpecifier *  namespaceSpecifier)
protected

◆ InsertQualifierAndName()

void clang::insights::CodeGenerator::InsertQualifierAndName ( const DeclarationName &  declName,
const NestedNameSpecifier *  qualifier,
const bool  hasTemplateKeyword 
)
protected

◆ InsertQualifierAndNameWithTemplateArgs()

void clang::insights::CodeGenerator::InsertQualifierAndNameWithTemplateArgs ( const DeclarationName &  declName,
const auto *  stmt 
)
inlineprotected

◆ InsertSemi()

virtual bool clang::insights::CodeGenerator::InsertSemi ( )
inlineprotectedvirtual

◆ InsertSuffix()

void clang::insights::CodeGenerator::InsertSuffix ( const QualType &  type)
protected

Definition at line 4519 of file CodeGenerator.cpp.

◆ InsertTemplate()

void clang::insights::CodeGenerator::InsertTemplate ( const FunctionTemplateDecl *  stmt,
bool  withSpec 
)
protected

Definition at line 3678 of file CodeGenerator.cpp.

References LAMBDA_SCOPE_HELPER, and RETURN_IF.

◆ InsertTemplateArg() [1/2]

void clang::insights::CodeGenerator::InsertTemplateArg ( const TemplateArgument &  arg)

◆ InsertTemplateArg() [2/2]

void clang::insights::CodeGenerator::InsertTemplateArg ( const TemplateArgumentLoc &  arg)
inlineprotected

Definition at line 315 of file CodeGenerator.h.

References InsertTemplateArg().

Referenced by InsertTemplateArg().

◆ InsertTemplateArgs() [1/3]

template<typename T >
void clang::insights::CodeGenerator::InsertTemplateArgs ( const ArrayRef< T > &  array)
inline

◆ InsertTemplateArgs() [2/3]

void clang::insights::CodeGenerator::InsertTemplateArgs ( const ClassTemplateSpecializationDecl &  clsTemplateSpe)

Definition at line 4531 of file CodeGenerator.cpp.

◆ InsertTemplateArgs() [3/3]

template<typename T >
void clang::insights::CodeGenerator::InsertTemplateArgs ( const T &  t)
inline

◆ InsertTemplateArgsObjectParam() [1/2]

void clang::insights::CodeGenerator::InsertTemplateArgsObjectParam ( const ArrayRef< TemplateArgument > &  array)
protected

◆ InsertTemplateArgsObjectParam() [2/2]

void clang::insights::CodeGenerator::InsertTemplateArgsObjectParam ( const TemplateParamObjectDecl &  param)
protected

◆ InsertTemplateGuardBegin()

void clang::insights::CodeGenerator::InsertTemplateGuardBegin ( const FunctionDecl *  stmt)
protected

◆ InsertTemplateGuardEnd()

void clang::insights::CodeGenerator::InsertTemplateGuardEnd ( const FunctionDecl *  stmt)
protected

◆ InsertTemplateParameters()

void clang::insights::CodeGenerator::InsertTemplateParameters ( const TemplateParameterList &  list,
const TemplateParamsOnly  templateParamsOnly = TemplateParamsOnly::No 
)

◆ InsertTemplateSpecializationHeader()

void clang::insights::CodeGenerator::InsertTemplateSpecializationHeader ( const Decl &  decl)
protected

Insert template<> to introduce a template specialization.

Definition at line 1251 of file CodeGenerator.cpp.

References clang::insights::OutputFormatHelper::AppendNewLine(), InsertTemplateArgsObjectParam(), kwTemplate, and mOutputFormatHelper.

◆ InsertVarDecl()

virtual bool clang::insights::CodeGenerator::InsertVarDecl ( const VarDecl *  )
inlineprotectedvirtual

◆ InsideDecltype()

bool clang::insights::CodeGenerator::InsideDecltype ( ) const
protected

Definition at line 2108 of file CodeGenerator.cpp.

◆ LifetimeAddExtended()

void clang::insights::CodeGenerator::LifetimeAddExtended ( const VarDecl *  vd,
const ValueDecl *  extending 
)

◆ ParseDeclContext()

void clang::insights::CodeGenerator::ParseDeclContext ( const DeclContext *  Ctx)
protected

Definition at line 3542 of file CodeGenerator.cpp.

References clang::insights::GetDeclContext().

◆ ShowXValueCasts()

virtual bool clang::insights::CodeGenerator::ShowXValueCasts ( ) const
inlineprotectedvirtual

Show casts to xvalues independent from the show all casts option.

This helps showing xvalue casts in structured bindings.

Reimplemented in clang::insights::StructuredBindingsCodeGenerator.

Definition at line 293 of file CodeGenerator.h.

◆ SkipSpaceAfterVarDecl()

virtual bool clang::insights::CodeGenerator::SkipSpaceAfterVarDecl ( )
inlineprotectedvirtual

Reimplemented in clang::insights::CoroutinesCodeGenerator.

Definition at line 285 of file CodeGenerator.h.

◆ StartLifetimeScope()

void clang::insights::CodeGenerator::StartLifetimeScope ( )

◆ STRONG_BOOL() [1/11]

clang::insights::CodeGenerator::STRONG_BOOL ( AddNewLineAfter  )
protected

◆ STRONG_BOOL() [2/11]

clang::insights::CodeGenerator::STRONG_BOOL ( AddSpaceAtTheEnd  )
protected

◆ STRONG_BOOL() [3/11]

clang::insights::CodeGenerator::STRONG_BOOL ( InsertInline  )
protected

◆ STRONG_BOOL() [4/11]

clang::insights::CodeGenerator::STRONG_BOOL ( LambdaInInitCapture  )
protected

◆ STRONG_BOOL() [5/11]

clang::insights::CodeGenerator::STRONG_BOOL ( NoEmptyInitList  )
protected

◆ STRONG_BOOL() [6/11]

clang::insights::CodeGenerator::STRONG_BOOL ( ProcessingPrimaryTemplate  )
protected

! Signal whether we are processing a lambda created and assigned to an init capture of another lambda.

◆ STRONG_BOOL() [7/11]

clang::insights::CodeGenerator::STRONG_BOOL ( ShowConstantExprValue  )
protected

◆ STRONG_BOOL() [8/11]

clang::insights::CodeGenerator::STRONG_BOOL ( SkipBody  )
protected

◆ STRONG_BOOL() [9/11]

clang::insights::CodeGenerator::STRONG_BOOL ( SkipVarDecl  )
protected

◆ STRONG_BOOL() [10/11]

clang::insights::CodeGenerator::STRONG_BOOL ( TemplateParamsOnly  )

◆ STRONG_BOOL() [11/11]

clang::insights::CodeGenerator::STRONG_BOOL ( UseCommaInsteadOfSemi  )
protected

◆ UpdateCurrentPos()

void clang::insights::CodeGenerator::UpdateCurrentPos ( std::optional< size_t > &  pos)
inlineprotected

◆ WrapInCompoundIfNeeded()

void clang::insights::CodeGenerator::WrapInCompoundIfNeeded ( const Stmt stmt,
const AddNewLineAfter  addNewLineAfter 
)
protected

Definition at line 5085 of file CodeGenerator.cpp.

◆ WrapInCurliesIfNeeded()

void clang::insights::CodeGenerator::WrapInCurliesIfNeeded ( bool  needsParens,
void_func_ref  lambda,
const AddSpaceAtTheEnd  addSpaceAtTheEnd = AddSpaceAtTheEnd::No 
)
protected

Definition at line 5138 of file CodeGenerator.cpp.

Referenced by InsertCXXMethodHeader().

◆ WrapInCurlys()

void clang::insights::CodeGenerator::WrapInCurlys ( void_func_ref  lambda,
const AddSpaceAtTheEnd  addSpaceAtTheEnd = AddSpaceAtTheEnd::No 
)
protected

Definition at line 5150 of file CodeGenerator.cpp.

◆ WrapInParens()

void clang::insights::CodeGenerator::WrapInParens ( void_func_ref  lambda,
const AddSpaceAtTheEnd  addSpaceAtTheEnd = AddSpaceAtTheEnd::No 
)
protected

◆ WrapInParensIfNeeded()

void clang::insights::CodeGenerator::WrapInParensIfNeeded ( bool  needsParens,
void_func_ref  lambda,
const AddSpaceAtTheEnd  addSpaceAtTheEnd = AddSpaceAtTheEnd::No 
)
protected

Definition at line 5126 of file CodeGenerator.cpp.

◆ WrapInParensOrCurlys()

void clang::insights::CodeGenerator::WrapInParensOrCurlys ( const BraceKind  curlys,
void_func_ref  lambda,
const AddSpaceAtTheEnd  addSpaceAtTheEnd = AddSpaceAtTheEnd::No 
)
protected

Definition at line 5061 of file CodeGenerator.cpp.

Referenced by InsertCXXMethodHeader().

Friends And Related Function Documentation

◆ CodeGeneratorVariant

friend class CodeGeneratorVariant
friend

Definition at line 102 of file CodeGenerator.h.

Member Data Documentation

◆ MAX_FILL_VALUES_FOR_ARRAYS

constexpr auto clang::insights::CodeGenerator::MAX_FILL_VALUES_FOR_ARRAYS
staticconstexprprotected
Initial value:
{
uint64_t{100}}

This is the upper limit of elements which will be shown for an array when filled by FillConstantArray.

Definition at line 444 of file CodeGenerator.h.

Referenced by FillConstantArray().

◆ mCurrentCallExprPos

std::optional<size_t> clang::insights::CodeGenerator::mCurrentCallExprPos {}
protected

The position in mOutputFormatHelper where a potential std::initializer_list expansion must be inserted.

Definition at line 449 of file CodeGenerator.h.

Referenced by InsertCXXMethodHeader().

◆ mCurrentFieldPos

std::optional<size_t> clang::insights::CodeGenerator::mCurrentFieldPos {}
protected

The position in mOutputFormatHelper in a class where where a potential std::initializer_list expansion must be inserted.

Definition at line 453 of file CodeGenerator.h.

Referenced by InsertCXXMethodHeader().

◆ mCurrentReturnPos

std::optional<size_t> clang::insights::CodeGenerator::mCurrentReturnPos {}
protected

The position in mOutputFormatHelper from a return where a potential std::initializer_list expansion must be inserted.

Definition at line 451 of file CodeGenerator.h.

◆ mCurrentVarDeclPos

std::optional<size_t> clang::insights::CodeGenerator::mCurrentVarDeclPos {}
protected

The position in mOutputFormatHelper where a potential std::initializer_list expansion must be inserted.

Definition at line 447 of file CodeGenerator.h.

Referenced by InsertCXXMethodHeader().

◆ mLambdaExpr

const LambdaExpr* clang::insights::CodeGenerator::mLambdaExpr {}
protected

Definition at line 443 of file CodeGenerator.h.

Referenced by HandleLambdaExpr().

◆ mLambdaInitCapture

LambdaInInitCapture clang::insights::CodeGenerator::mLambdaInitCapture {LambdaInInitCapture::No}
protected

Definition at line 436 of file CodeGenerator.h.

◆ mLambdaStack

LambdaStackType& clang::insights::CodeGenerator::mLambdaStack
protected

Definition at line 430 of file CodeGenerator.h.

Referenced by clang::insights::CfrontCodeGenerator::InsertArg().

◆ mLambdaStackThis

LambdaStackType clang::insights::CodeGenerator::mLambdaStackThis
protected

Definition at line 429 of file CodeGenerator.h.

◆ mLastDecl

const Decl* clang::insights::CodeGenerator::mLastDecl {}

Definition at line 98 of file CodeGenerator.h.

Referenced by clang::insights::CfrontCodeGenerator::InsertArg().

◆ mLastExpr

const Expr* clang::insights::CodeGenerator::mLastExpr {}
protected

Definition at line 95 of file CodeGenerator.h.

Referenced by clang::insights::CfrontCodeGenerator::InsertArg().

◆ mLastStmt

const Stmt* clang::insights::CodeGenerator::mLastStmt {}
protected

Definition at line 94 of file CodeGenerator.h.

Referenced by clang::insights::CfrontCodeGenerator::InsertArg().

◆ mLifeTimeTracker

LifetimeTracker clang::insights::CodeGenerator::mLifeTimeTracker {}
protected

◆ mNoEmptyInitList

NoEmptyInitList clang::insights::CodeGenerator::mNoEmptyInitList
protected
Initial value:
{
NoEmptyInitList::No}

At least in case if a requires-clause containing T{} we don't want to get T{{}}.

Definition at line 441 of file CodeGenerator.h.

◆ mOutputFormatHelper

OutputFormatHelper& clang::insights::CodeGenerator::mOutputFormatHelper
protected

◆ mOutputFormatHelperOutside

OutputFormatHelper* clang::insights::CodeGenerator::mOutputFormatHelperOutside
protected
Initial value:
{
nullptr}

Helper output buffer for std::initializer_list expansion.

Definition at line 455 of file CodeGenerator.h.

Referenced by InsertCXXMethodHeader().

◆ mProcessingPrimaryTemplate

ProcessingPrimaryTemplate clang::insights::CodeGenerator::mProcessingPrimaryTemplate {}
protected

Definition at line 459 of file CodeGenerator.h.

Referenced by InsertMethodBody().

◆ mProcessingVarDecl

bool clang::insights::CodeGenerator::mProcessingVarDecl {}
protected

Definition at line 101 of file CodeGenerator.h.

◆ mRequiresImplicitReturnZero

bool clang::insights::CodeGenerator::mRequiresImplicitReturnZero {}
protected

Track whether this is a function with an imlpicit return 0.

Definition at line 457 of file CodeGenerator.h.

Referenced by InsertMethodBody().

◆ mSeenDecls

std::map<std::string, bool> clang::insights::CodeGenerator::mSeenDecls {}
inlinestaticprotected

Definition at line 460 of file CodeGenerator.h.

Referenced by InsertTemplateArgsObjectParam().

◆ mShowConstantExprValue

ShowConstantExprValue clang::insights::CodeGenerator::mShowConstantExprValue {ShowConstantExprValue::No}
protected

Definition at line 438 of file CodeGenerator.h.

◆ mSkipSemi

bool clang::insights::CodeGenerator::mSkipSemi {}
protected

Definition at line 458 of file CodeGenerator.h.

Referenced by EndLifetimeScope().

◆ mSkipVarDecl

SkipVarDecl clang::insights::CodeGenerator::mSkipVarDecl {SkipVarDecl::No}
protected

Definition at line 439 of file CodeGenerator.h.

◆ mUseCommaInsteadOfSemi

UseCommaInsteadOfSemi clang::insights::CodeGenerator::mUseCommaInsteadOfSemi {UseCommaInsteadOfSemi::No}
protected

Definition at line 440 of file CodeGenerator.h.


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