A special generator for coroutines. It is only activated, if -show-coroutines-transformation
is given as a command line option.
More...
#include "CodeGenerator.h"
Classes | |
struct | CfrontVtableData |
Public Member Functions | |
void | InsertArg (const CXXThisExpr *) override |
void | InsertArg (const CXXDeleteExpr *) override |
void | InsertArg (const CXXNewExpr *) override |
void | InsertArg (const CXXOperatorCallExpr *) override |
void | InsertArg (const CXXNullPtrLiteralExpr *) override |
void | InsertArg (const StaticAssertDecl *) override |
void | InsertArg (const CXXRecordDecl *) override |
void | InsertArg (const CXXMemberCallExpr *) override |
void | InsertArg (const CXXConstructExpr *) override |
void | InsertArg (const FunctionDecl *stmt) override |
void | InsertArg (const TypedefDecl *stmt) override |
void | InsertCXXMethodDecl (const CXXMethodDecl *, CodeGenerator::SkipBody) override |
void | FormatCast (const std::string_view, const QualType &, const Expr *, const CastKind &) override |
constexpr | CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaStackType &lambdaStack, LambdaInInitCapture lambdaInitCapture, ProcessingPrimaryTemplate processingPrimaryTemplate) |
! We do not want to transform a primary template which contains a Coroutine. More... | |
constexpr | CodeGenerator (OutputFormatHelper &_outputFormatHelper) |
constexpr | CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaInInitCapture lambdaInitCapture) |
constexpr | CodeGenerator (OutputFormatHelper &_outputFormatHelper, LambdaStackType &lambdaStack, ProcessingPrimaryTemplate processingPrimaryTemplate) |
virtual void | InsertArg (const Decl *stmt) |
virtual void | InsertArg (const Stmt *stmt) |
![]() | |
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 () |
Static Public Member Functions | |
static CfrontVtableData & | VtableData () |
Protected Member Functions | |
bool | InsertSemi () override |
![]() | |
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 | 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... | |
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 ¶m) |
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) | |
Additional Inherited Members | |
![]() | |
const Decl * | mLastDecl {} |
![]() | |
enum class | LambdaCallerType { VarDecl , InitCapture , CallExpr , OperatorCallExpr , MemberCallExpr , LambdaExpr , ReturnStmt , BinaryOperator , CXXMethodDecl , TemplateHead , Decltype } |
enum class | BraceKind { Parens , Curlys } |
using | LambdaStackType = StackList< class LambdaHelper > |
![]() | |
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) |
![]() | |
LifetimeTracker | mLifeTimeTracker {} |
const Stmt * | mLastStmt {} |
const Expr * | mLastExpr {} |
bool | mProcessingVarDecl {} |
OutputFormatHelper & | mOutputFormatHelper |
LambdaStackType | mLambdaStackThis |
LambdaStackType & | mLambdaStack |
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 {} |
OutputFormatHelper * | mOutputFormatHelperOutside |
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 constexpr auto | MAX_FILL_VALUES_FOR_ARRAYS |
static std::map< std::string, bool > | mSeenDecls {} |
A special generator for coroutines. It is only activated, if -show-coroutines-transformation
is given as a command line option.
Definition at line 610 of file CodeGenerator.h.
|
inlineexplicitconstexpr |
Definition at line 186 of file CodeGenerator.h.
|
inlineconstexpr |
Definition at line 191 of file CodeGenerator.h.
|
inlineconstexpr |
! We do not want to transform a primary template which contains a Coroutine.
Definition at line 174 of file CodeGenerator.h.
|
inlineconstexpr |
Definition at line 196 of file CodeGenerator.h.
|
overridevirtual |
Reimplemented from clang::insights::CodeGenerator.
Definition at line 715 of file CfrontCodeGenerator.cpp.
References clang::insights::is< T >::any_of(), clang::insights::OutputFormatHelper::Append(), clang::insights::GetName(), InsertArg(), clang::insights::CodeGenerator::mOutputFormatHelper, and clang::insights::mThisPointerOffset.
|
override |
Definition at line 1156 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::asthelpers::ArgsToExprVector(), clang::insights::asthelpers::Call(), clang::insights::asthelpers::CallConstructor(), clang::insights::CallVecCtor(), clang::insights::asthelpers::Cast(), StackList< T >::empty(), clang::insights::GetName(), clang::insights::asthelpers::GetRecordDeclType(), clang::insights::GetSize(), clang::insights::GetSpecialMemberName(), clang::insights::HasCtor(), InsertArg(), clang::insights::asthelpers::Int32(), clang::insights::IsCopyOrMoveCtor(), clang::insights::asthelpers::mkDeclRefExpr(), clang::insights::asthelpers::mkVarDeclRefExpr(), clang::insights::CodeGenerator::mLambdaStack, clang::insights::CodeGenerator::mLastDecl, clang::insights::CodeGenerator::mLastStmt, clang::insights::CodeGenerator::mOutputFormatHelper, clang::insights::asthelpers::Ptr(), clang::insights::asthelpers::Ref(), RETURN_IF, and clang::insights::CodeGenerator::VarDecl.
|
override |
Definition at line 231 of file CfrontCodeGenerator.cpp.
References clang::insights::asthelpers::StmtsContainer::Add(), clang::insights::asthelpers::Call(), clang::insights::CallVecDelete(), clang::insights::EnableGlobalInsert(), clang::insights::FuncFree, clang::insights::GetName(), clang::insights::HasDtor(), clang::insights::asthelpers::If(), InsertArg(), and clang::insights::StrCat().
|
override |
Definition at line 1030 of file CfrontCodeGenerator.cpp.
References clang::insights::AccessMember(), clang::insights::asthelpers::ArraySubscript(), clang::insights::asthelpers::Call(), clang::insights::CallVecDtor(), clang::insights::asthelpers::Dref(), clang::insights::asthelpers::Function(), clang::insights::GetFirstPolymorphicBase(), GetGlobalAST(), clang::insights::GetSpecialMemberName(), clang::insights::CodeGenerator::InsertArg(), InsertArg(), clang::insights::IsReferenceType(), kwInternalThis, clang::insights::asthelpers::Paren(), clang::insights::asthelpers::Plus(), clang::insights::asthelpers::Ptr(), clang::insights::asthelpers::Ref(), clang::insights::asthelpers::ReinterpretCast(), clang::insights::asthelpers::VoidTy(), VtableData(), and clang::insights::CfrontCodeGenerator::CfrontVtableData::VtblPtrField().
|
override |
Definition at line 298 of file CfrontCodeGenerator.cpp.
References clang::insights::asthelpers::StmtsContainer::Add(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::asthelpers::ArraySubscript(), clang::insights::asthelpers::Assign(), clang::insights::asthelpers::Call(), clang::insights::CallVecNew(), clang::insights::asthelpers::Cast(), clang::insights::asthelpers::Dref(), clang::insights::EnableGlobalInsert(), clang::insights::FuncMalloc, clang::insights::GetName(), clang::insights::HasCtor(), clang::insights::HasDtor(), clang::insights::HeaderStddef, clang::insights::asthelpers::If(), InsertArg(), kwNull, clang::insights::asthelpers::mkDeclRefExpr(), clang::insights::CodeGenerator::mLastDecl, clang::insights::CodeGenerator::mLastExpr, clang::insights::CodeGenerator::mOutputFormatHelper, clang::insights::asthelpers::Mul(), clang::insights::asthelpers::Ptr(), clang::insights::asthelpers::Sizeof(), and clang::insights::StrCat().
|
override |
Definition at line 764 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::EnableGlobalInsert(), clang::insights::HeaderStddef, kwNull, and clang::insights::CodeGenerator::mOutputFormatHelper.
|
override |
Definition at line 422 of file CfrontCodeGenerator.cpp.
References clang::insights::asthelpers::Call(), InsertArg(), clang::insights::IsCopyOrMoveAssign(), and clang::insights::asthelpers::Ref().
|
override |
Definition at line 847 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::asthelpers::ContantArrayTy(), clang::insights::DPrint(), clang::insights::EnableGlobalInsert(), clang::insights::FuncCxaPureVirtual, clang::insights::asthelpers::Function(), clang::insights::FuncVtableStruct, clang::insights::GetFirstPolymorphicBaseName(), GetGlobalAST(), clang::insights::GetName(), clang::insights::asthelpers::GetRecordDeclType(), clang::insights::GetSpecialMemberName(), clang::insights::HeaderStdlib, clang::insights::asthelpers::InitList(), clang::insights::CodeGenerator::InsertArg(), InsertArg(), clang::insights::asthelpers::Int32(), kwInternalThis, kwTypedefSpace, clang::insights::asthelpers::mkVarDeclRefExpr(), clang::insights::CodeGenerator::mOutputFormatHelper, clang::insights::mThisPointerOffset, clang::insights::ProcessFields(), clang::insights::PushVtableEntry(), clang::insights::asthelpers::ReinterpretCast(), clang::insights::StrCat(), clang::insights::asthelpers::Struct(), clang::insights::asthelpers::Typedef(), clang::insights::asthelpers::Variable(), clang::insights::asthelpers::VoidTy(), and VtableData().
|
override |
Definition at line 176 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), kwInternalThis, and clang::insights::CodeGenerator::mOutputFormatHelper.
void clang::insights::CodeGenerator::InsertArg |
Definition at line 214 of file CodeGenerator.cpp.
Referenced by FormatCast(), InsertArg(), and InsertCXXMethodDecl().
|
override |
Definition at line 1116 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::BuildInternalVarName(), clang::insights::asthelpers::Call(), cxaAtExit, cxaStart, clang::insights::asthelpers::Function(), clang::insights::GetName(), clang::insights::CodeGenerator::InsertArg(), InsertArg(), clang::insights::asthelpers::mkCompoundStmt(), clang::insights::asthelpers::mkDeclRefExpr(), clang::insights::asthelpers::mkDeclStmt(), clang::insights::CodeGenerator::mOutputFormatHelper, clang::insights::asthelpers::Return(), clang::insights::asthelpers::to_params_view(), and clang::insights::asthelpers::Variable().
|
override |
Definition at line 772 of file CfrontCodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::EnableGlobalInsert(), clang::insights::HeaderAssert, InsertArg(), clang::insights::CodeGenerator::mOutputFormatHelper, and clang::insights::CodeGenerator::WrapInParens().
void clang::insights::CodeGenerator::InsertArg |
Definition at line 215 of file CodeGenerator.cpp.
|
override |
|
override |
Definition at line 462 of file CfrontCodeGenerator.cpp.
References clang::insights::AccessMember(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::asthelpers::ArgsToExprVector(), clang::insights::asthelpers::Assign(), clang::insights::asthelpers::Call(), clang::insights::asthelpers::CallConstructor(), clang::insights::asthelpers::Cast(), clang::insights::asthelpers::Comment(), clang::insights::asthelpers::Function(), GetGlobalAST(), clang::insights::GetName(), clang::insights::asthelpers::GetRecordDeclType(), clang::insights::GetSpecialMemberName(), clang::insights::HasCtor(), clang::insights::HasDtor(), InsertArg(), clang::insights::InsertVtblPtr(), clang::insights::IsCopyOrMoveAssign(), clang::insights::IsCopyOrMoveCtor(), clang::insights::IsStaticStorageClass(), kwInternalThis, clang::insights::asthelpers::mkCompoundStmt(), clang::insights::asthelpers::mkVarDeclRefExpr(), clang::insights::CodeGenerator::mOutputFormatHelper, clang::insights::asthelpers::Ptr(), clang::insights::asthelpers::Ref(), clang::insights::asthelpers::Return(), RETURN_IF, clang::insights::OutputFormatHelper::SetIndent(), clang::insights::asthelpers::StaticCast(), clang::insights::StrCat(), and clang::insights::asthelpers::to_params_view().
|
inlineoverrideprotectedvirtual |
Reimplemented from clang::insights::CodeGenerator.
Definition at line 665 of file CodeGenerator.h.
|
static |
Definition at line 73 of file CfrontCodeGenerator.cpp.
Referenced by clang::insights::EmitGlobalVariableCtors(), InsertArg(), clang::insights::InsertVtblPtr(), and clang::insights::ProcessFields().