More or less the heart of C++ Insights. More...
#include "CodeGenerator.h"


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. | |
| 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. | |
| 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. | |
| 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. | |
| void | HandleTemplateParameterPack (const ArrayRef< TemplateArgument > &args) |
| void | HandleCompoundStmt (const CompoundStmt *stmt) |
| void | HandleLocalStaticNonTrivialClass (const VarDecl *stmt) |
| Show what is behind a local static variable. | |
| 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. | |
| 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. | |
| void | InsertCurlysIfRequired (const Stmt *stmt) |
| Check whether or not this statement will add curlys or parentheses and add them only if required. | |
| 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. | |
| 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 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{{}}. | |
| 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. | |
| bool | mRequiresImplicitReturnZero {} |
| Track whether this is a function with an imlpicit return 0. | |
| 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 |
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.
|
protected |
Definition at line 166 of file CodeGenerator.h.
|
strongprotected |
| Enumerator | |
|---|---|
| Parens | |
| Curlys | |
Definition at line 381 of file CodeGenerator.h.
|
strongprotected |
| Enumerator | |
|---|---|
| VarDecl | |
| InitCapture | |
| CallExpr | |
| OperatorCallExpr | |
| MemberCallExpr | |
| LambdaExpr | |
| ReturnStmt | |
| BinaryOperator | |
| CXXMethodDecl | |
| TemplateHead | |
| Decltype | |
Definition at line 106 of file CodeGenerator.h.
|
inlineconstexprprotected |
! We do not want to transform a primary template which contains a Coroutine.
Definition at line 174 of file CodeGenerator.h.
|
inlineexplicitconstexpr |
Definition at line 186 of file CodeGenerator.h.
|
inlineconstexpr |
Definition at line 191 of file CodeGenerator.h.
|
inlineconstexpr |
Definition at line 196 of file CodeGenerator.h.
|
virtualdefault |
| void clang::insights::CodeGenerator::EndLifetimeScope | ( | ) |
Definition at line 1193 of file CodeGenerator.cpp.
References clang::insights::LifetimeTracker::EndScope(), mLifeTimeTracker, mOutputFormatHelper, and mSkipSemi.
Referenced by clang::insights::TemporaryDeclFinder::~TemporaryDeclFinder().
|
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 1937 of file CodeGenerator.cpp.
References clang::insights::for_each(), clang::insights::GetSize(), and MAX_FILL_VALUES_FOR_ARRAYS.
Referenced by GetValueOfValueInit().
|
inlineprotected |
Definition at line 310 of file CodeGenerator.h.
References clang::insights::OutputFormatHelper::ForEachArg(), and mOutputFormatHelper.
Referenced by HandleTemplateParameterPack(), InsertConstructorExpr(), and InsertTemplateArgs().
|
protectedvirtual |
Reimplemented in clang::insights::CfrontCodeGenerator.
Definition at line 4551 of file CodeGenerator.cpp.
References clang::insights::is< T >::any_of(), clang::insights::OutputFormatHelper::Append(), clang::insights::GetName(), InsertArg(), mOutputFormatHelper, and clang::insights::StrCat().
|
staticprotected |
|
staticprotected |
Definition at line 3023 of file CodeGenerator.cpp.
References clang::insights::Error(), FillConstantArray(), GetValueOfValueInit(), kwFalse, and kwNullptr.
Referenced by GetValueOfValueInit().
|
protected |
Definition at line 2503 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), StackList< T >::empty(), InsertArg(), InsertSemi(), clang::insights::IsStmtRequiringSemi(), mLambdaStack, mOutputFormatHelper, and mSkipSemi.
|
protected |
Definition at line 4809 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::CodeGenerator::LambdaHelper::buffer(), InsertArg(), mLambdaExpr, mLambdaStack, and mProcessingPrimaryTemplate.
|
protected |
Show what is behind a local static variable.
[stmt.dcl] p4: Initialization of a block-scope variable with static storage duration is thread-safe since C++11. Regardless of that, as long as it is a non-trivally construct and destructable class the compiler adds code to track the initialization state. Reference:
Definition at line 4675 of file CodeGenerator.cpp.
References clang::insights::asthelpers::StmtsContainer::AddBodyStmts(), clang::insights::asthelpers::And(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::asthelpers::Assign(), clang::insights::asthelpers::Bool(), clang::insights::BuildInternalVarName(), clang::insights::asthelpers::Call(), clang::insights::asthelpers::Catch(), clang::insights::asthelpers::Comment(), clang::insights::EnableGlobalInsert(), clang::insights::asthelpers::Equal(), GetGlobalAST(), clang::insights::GetLangOpts(), clang::insights::GetName(), clang::insights::HeaderNew, clang::insights::HeaderUtility, clang::insights::asthelpers::If(), InsertArg(), clang::insights::asthelpers::Int32(), clang::insights::asthelpers::mkCompoundStmt(), mOutputFormatHelper, clang::insights::asthelpers::New(), clang::insights::asthelpers::Ref(), clang::insights::asthelpers::Sizeof(), clang::insights::StrCat(), clang::insights::asthelpers::Throw(), clang::insights::asthelpers::Try(), clang::insights::asthelpers::Typedef(), and clang::insights::asthelpers::Variable().
|
protected |
Definition at line 4605 of file CodeGenerator.cpp.
References ForEachArg(), and InsertTemplateArg().
Referenced by InsertTemplateArg().
|
virtual |
Reimplemented in clang::insights::ArrayInitCodeGenerator, clang::insights::StructuredBindingsCodeGenerator, clang::insights::UsingCodeGenerator, clang::insights::LambdaInitCaptureCodeGenerator, clang::insights::LambdaNameOnlyCodeGenerator, clang::insights::LambdaCodeGenerator, clang::insights::MultiStmtDeclCodeGenerator, clang::insights::CoroutinesCodeGenerator, and clang::insights::CfrontCodeGenerator.
Definition at line 4510 of file CodeGenerator.cpp.
References mLastDecl, mOutputFormatHelper, and clang::insights::ToDo().
Referenced by clang::insights::EmitGlobalVariableCtors(), FormatCast(), clang::insights::GetNoExcept(), HandleCompoundStmt(), HandleLambdaExpr(), HandleLocalStaticNonTrivialClass(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::LambdaInitCaptureCodeGenerator::InsertArg(), clang::insights::UsingCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), InsertArgWithParensIfNeeded(), InsertConceptConstraint(), InsertCurlysIfRequired(), InsertCXXMethodHeader(), InsertFunctionNameWithReturnType(), InsertIfOrSwitchInitVariables(), InsertMethodBody(), InsertTemplate(), InsertTemplateArg(), InsertTemplateParameters(), clang::insights::P0315Visitor_HandleLambdaExpr(), clang::insights::TemporaryDeclFinder::TemporaryDeclFinder(), WrapInCompoundIfNeeded(), and clang::insights::CoroutinesCodeGenerator::~CoroutinesCodeGenerator().
|
virtual |
Reimplemented in clang::insights::ArrayInitCodeGenerator, clang::insights::StructuredBindingsCodeGenerator, clang::insights::UsingCodeGenerator, clang::insights::LambdaInitCaptureCodeGenerator, clang::insights::LambdaNameOnlyCodeGenerator, clang::insights::LambdaCodeGenerator, clang::insights::MultiStmtDeclCodeGenerator, clang::insights::CoroutinesCodeGenerator, and clang::insights::CfrontCodeGenerator.
Definition at line 4528 of file CodeGenerator.cpp.
References clang::insights::DPrint(), mLastStmt, mOutputFormatHelper, and clang::insights::ToDo().
|
protected |
Definition at line 4567 of file CodeGenerator.cpp.
References InsertArg(), and WrapInParensIfNeeded().
| void clang::insights::CodeGenerator::InsertAttribute | ( | const Attr & | attr | ) |
Definition at line 3800 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::Ellipsis(), GetGlobalAST(), clang::insights::GetName(), kwAlignof, mOutputFormatHelper, and RETURN_IF.
Referenced by InsertAttributes().
| void clang::insights::CodeGenerator::InsertAttributes | ( | const Decl * | stmt | ) |
Definition at line 3781 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), InsertAttributes(), and mOutputFormatHelper.
Referenced by clang::insights::OutputFormatHelper::AppendParameterList(), clang::insights::StructuredBindingsCodeGenerator::InsertArg(), InsertAttributes(), and InsertFunctionNameWithReturnType().
| void clang::insights::CodeGenerator::InsertAttributes | ( | const Decl::attr_range & | attrs | ) |
Definition at line 3791 of file CodeGenerator.cpp.
References InsertAttribute().
|
inlineprotectedvirtual |
Reimplemented in clang::insights::MultiStmtDeclCodeGenerator.
Definition at line 286 of file CodeGenerator.h.
|
protected |
Definition at line 4853 of file CodeGenerator.cpp.
References InsertConceptConstraint().
|
protected |
Definition at line 4823 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), InsertArg(), kwRequiresSpace, and mOutputFormatHelper.
Referenced by InsertConceptConstraint(), InsertConceptConstraint(), InsertFunctionNameWithReturnType(), and InsertTemplateParameters().
|
protected |
Definition at line 4842 of file CodeGenerator.cpp.
References InsertConceptConstraint().
|
protected |
Definition at line 4873 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), kwCCommentEndSpace, kwCommentStart, and mOutputFormatHelper.
|
protected |
Generalized function to insert either a CXXConstructExpr or CXXUnresolvedConstructExpr.
Definition at line 2021 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), CONDITIONAL_LAMBDA_SCOPE_HELPER, Curlys, Decltype, StackList< T >::empty(), ForEachArg(), clang::insights::GetName(), MemberCallExpr, mLambdaStack, mOutputFormatHelper, Parens, RETURN_IF, clang::insights::ValueOr(), and WrapInParensOrCurlys().
|
protected |
Check whether or not this statement will add curlys or parentheses and add them only if required.
Definition at line 5135 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), InsertArg(), and mOutputFormatHelper.
Referenced by InsertCXXMethodHeader().
|
protectedvirtual |
Definition at line 3296 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::OutputFormatHelper::CurrentPos(), InsertCXXMethodHeader(), InsertLambdaStaticInvoker(), InsertMethodBody(), InsertTemplateGuardEnd(), kwReturn, mOutputFormatHelper, clang::insights::OutputFormatHelper::SetIndent(), and WrapInCurlys().
Referenced by clang::insights::UsingCodeGenerator::InsertArg().
|
protected |
For a special case, when a LambdaExpr occurs in a Constructor from an in class initializer, there is a need for a more narrow scope for the LAMBDA_SCOPE_HELPER.
Definition at line 3215 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), Curlys, CXXMethodDecl, clang::insights::GetUnqualifiedScopelessName(), InsertArg(), InsertCurlysIfRequired(), InsertFunctionNameWithReturnType(), InsertTemplateGuardBegin(), LAMBDA_SCOPE_HELPER, mCurrentCallExprPos, mCurrentFieldPos, mCurrentVarDeclPos, mLambdaStack, mOutputFormatHelper, mOutputFormatHelperOutside, mProcessingPrimaryTemplate, Parens, WrapInCurliesIfNeeded(), WrapInParens(), and WrapInParensOrCurlys().
Referenced by InsertCXXMethodDecl().
| 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.
| decl | The FunctionDecl to process. |
| skipAccess | Show or hide access modifiers (public, private, protected). The default is to show them. |
| cxxInheritedCtorDecl | If not null, the type and name of this decl is used for the parameters. |
Definition at line 4885 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendParameterList(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::BuildRetTypeName(), clang::insights::GetConst(), clang::insights::GetDesugarReturnType(), GetInsightsOptions(), clang::insights::GetName(), clang::insights::GetNoExcept(), clang::insights::GetStorageClassAsStringWithSpace(), clang::insights::OutputFormatHelper::GetString(), clang::insights::GetType(), clang::insights::GetTypeNameAsParameter(), hlpAssing, InsertArg(), InsertAttributes(), InsertConceptConstraint(), InsertNamespace(), InsertTemplateArgs(), InsertTemplateParameters(), InsertTemplateSpecializationHeader(), clang::insights::IsStaticStorageClass(), kwCCommentEndSpace, kwCommentStart, kwConstEvalSpace, kwConstExprSpace, kwCppCommentStartSpace, kwExplicit, kwExplicitSpace, kwFriendSpace, kwInlineSpace, kwOperatorSpace, kwSpaceEqualsDefault, kwSpaceEqualsDelete, kwSpaceFinal, kwSpaceVolatile, kwStaticSpace, kwUsingSpace, kwVirtualSpace, mOutputFormatHelper, and WrapInParens().
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 2531 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), InsertArg(), and mOutputFormatHelper.
|
protected |
Inserts the instantiation point of a template.
Definition at line 1550 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendCommentNewLine(), and mOutputFormatHelper.
Referenced by clang::insights::CoroutinesCodeGenerator::InsertArg(), and InsertTemplateGuardBegin().
|
protected |
Definition at line 1498 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendParameterList(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::OutputFormatHelper::CloseScope(), clang::insights::GetName(), InsertTemplateArgs(), InsertTemplateParameters(), kwReturn, mOutputFormatHelper, clang::insights::OutputFormatHelper::OpenScope(), and WrapInParens().
Referenced by InsertCXXMethodDecl().
|
protected |
Definition at line 1635 of file CodeGenerator.cpp.
References clang::insights::LifetimeTracker::Add(), clang::insights::is< T >::any_of(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::asthelpers::Call(), clang::insights::asthelpers::Catch(), clang::insights::EnableGlobalInsert(), GetInsightsOptions(), clang::insights::HeaderException, InsertArg(), clang::insights::asthelpers::mkCompoundStmt(), mLifeTimeTracker, mOutputFormatHelper, mProcessingPrimaryTemplate, mRequiresImplicitReturnZero, and clang::insights::asthelpers::Try().
Referenced by InsertCXXMethodDecl().
|
inlineprotectedvirtual |
Reimplemented in clang::insights::UsingCodeGenerator.
Definition at line 288 of file CodeGenerator.h.
Referenced by InsertFunctionNameWithReturnType(), and InsertTemplateArg().
|
protected |
Definition at line 395 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::GetNestedName(), mOutputFormatHelper, and clang::insights::ScopeHandler::RemoveCurrentScope().
|
protected |
Definition at line 385 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::GetNestedName(), kwTemplateSpace, mOutputFormatHelper, clang::insights::ScopeHandler::RemoveCurrentScope(), and clang::insights::ValueOrDefault().
Referenced by InsertQualifierAndNameWithTemplateArgs().
|
inlineprotected |
Definition at line 328 of file CodeGenerator.h.
References clang::insights::OutputFormatHelper::Append(), InsertQualifierAndName(), InsertTemplateArgs(), and mOutputFormatHelper.
|
inlineprotectedvirtual |
Reimplemented in clang::insights::MultiStmtDeclCodeGenerator, and clang::insights::CfrontCodeGenerator.
Definition at line 287 of file CodeGenerator.h.
Referenced by HandleCompoundStmt().
|
protected |
Definition at line 4583 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), GetBuiltinTypeSuffix(), and mOutputFormatHelper.
|
protected |
Definition at line 3731 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendNewLine(), InsertArg(), LAMBDA_SCOPE_HELPER, mOutputFormatHelper, mProcessingPrimaryTemplate, RETURN_IF, and TemplateHead.
| void clang::insights::CodeGenerator::InsertTemplateArg | ( | const TemplateArgument & | arg | ) |
Definition at line 4611 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::BuildTemplateParamObjectName(), clang::insights::EvaluateNTTPAsConstantExpr(), GetGlobalAST(), clang::insights::GetName(), HandleTemplateParameterPack(), InsertArg(), InsertNamespace(), kwNullptr, kwTemplateSpace, mOutputFormatHelper, and clang::insights::ToDo().
Referenced by HandleTemplateParameterPack(), clang::insights::CoroutinesCodeGenerator::InsertCoroutine(), InsertTemplateArgs(), and InsertTemplateParameters().
|
inlineprotected |
Definition at line 315 of file CodeGenerator.h.
References InsertTemplateArg().
Referenced by InsertTemplateArg().
|
inline |
Definition at line 255 of file CodeGenerator.h.
References clang::insights::OutputFormatHelper::Append(), ForEachArg(), clang::insights::OutputFormatHelper::GetString(), InsertTemplateArg(), and mOutputFormatHelper.
| void clang::insights::CodeGenerator::InsertTemplateArgs | ( | const ClassTemplateSpecializationDecl & | clsTemplateSpe | ) |
Definition at line 4595 of file CodeGenerator.cpp.
References InsertTemplateArgs().
|
inline |
Definition at line 218 of file CodeGenerator.h.
References InsertTemplateArgs().
Referenced by clang::insights::GetDeclContext(), clang::insights::StructuredBindingsCodeGenerator::InsertArg(), InsertFunctionNameWithReturnType(), InsertLambdaStaticInvoker(), InsertQualifierAndNameWithTemplateArgs(), InsertTemplateArgs(), InsertTemplateArgs(), and clang::insights::ScopeHandler::ScopeHandler().
|
protected |
Definition at line 1243 of file CodeGenerator.cpp.
References InsertTemplateArgsObjectParam().
Referenced by InsertTemplateArgsObjectParam(), InsertTemplateParameters(), and InsertTemplateSpecializationHeader().
|
protected |
Definition at line 1221 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), GetGlobalAST(), clang::insights::GetName(), mOutputFormatHelper, and mSeenDecls.
|
protected |
Definition at line 1569 of file CodeGenerator.cpp.
References clang::insights::GetSM(), clang::insights::OutputFormatHelper::InsertIfDefTemplateGuard(), InsertInstantiationPoint(), and mOutputFormatHelper.
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 1578 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::InsertEndIfTemplateGuard(), and mOutputFormatHelper.
Referenced by InsertCXXMethodDecl().
| void clang::insights::CodeGenerator::InsertTemplateParameters | ( | const TemplateParameterList & | list, |
| const TemplateParamsOnly | templateParamsOnly = TemplateParamsOnly::No |
||
| ) |
! Skip template, type constraints and class/typename.
Definition at line 1782 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendComma(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::AppendTemplateTypeParamName(), clang::insights::Ellipsis(), clang::insights::EllipsisSpace(), clang::insights::EvaluateNTTPAsConstantExpr(), GetGlobalAST(), clang::insights::GetName(), clang::insights::GetTypeConstraintAsString(), clang::insights::GetTypeNameAsParameter(), hlpAssing, InsertArg(), InsertConceptConstraint(), InsertTemplateArg(), InsertTemplateArgsObjectParam(), kwClassSpace, kwElipsisSpace, kwTemplate, kwTemplateSpace, kwTypeNameSpace, mOutputFormatHelper, and clang::insights::ValueOr().
Referenced by clang::insights::GetDeclContext(), InsertFunctionNameWithReturnType(), and InsertLambdaStaticInvoker().
|
protected |
Insert template<> to introduce a template specialization.
Definition at line 1255 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendNewLine(), InsertTemplateArgsObjectParam(), kwTemplate, and mOutputFormatHelper.
Referenced by InsertFunctionNameWithReturnType().
|
inlineprotectedvirtual |
Reimplemented in clang::insights::MultiStmtDeclCodeGenerator, and clang::insights::CoroutinesCodeGenerator.
Definition at line 284 of file CodeGenerator.h.
|
protected |
Definition at line 2144 of file CodeGenerator.cpp.
References StackList< T >::back(), clang::insights::CodeGenerator::LambdaHelper::callerType(), Decltype, StackList< T >::empty(), and mLambdaStack.
| void clang::insights::CodeGenerator::LifetimeAddExtended | ( | const VarDecl * | vd, |
| const ValueDecl * | extending | ||
| ) |
Definition at line 1181 of file CodeGenerator.cpp.
References clang::insights::LifetimeTracker::AddExtended(), and mLifeTimeTracker.
Referenced by clang::insights::TemporaryDeclFinder::VisitMaterializeTemporaryExpr().
|
protected |
Definition at line 3595 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::GetDeclContext(), and mOutputFormatHelper.
|
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.
|
inlineprotectedvirtual |
Reimplemented in clang::insights::CoroutinesCodeGenerator.
Definition at line 285 of file CodeGenerator.h.
| void clang::insights::CodeGenerator::StartLifetimeScope | ( | ) |
Definition at line 1187 of file CodeGenerator.cpp.
References mLifeTimeTracker, and clang::insights::LifetimeTracker::StartScope().
Referenced by clang::insights::TemporaryDeclFinder::VisitMaterializeTemporaryExpr().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
! Signal whether we are processing a lambda created and assigned to an init capture of another lambda.
|
protected |
|
protected |
|
protected |
| clang::insights::CodeGenerator::STRONG_BOOL | ( | TemplateParamsOnly | ) |
|
protected |
|
inlineprotected |
Definition at line 403 of file CodeGenerator.h.
References clang::insights::OutputFormatHelper::CurrentPos(), and mOutputFormatHelper.
|
protected |
Definition at line 5176 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::OutputFormatHelper::AppendNewLine(), clang::insights::OutputFormatHelper::AppendSemiNewLine(), clang::insights::OutputFormatHelper::CloseScope(), InsertArg(), mOutputFormatHelper, and clang::insights::OutputFormatHelper::OpenScope().
|
protected |
Definition at line 5229 of file CodeGenerator.cpp.
References Curlys, and WrapInParensOrCurlys().
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 5241 of file CodeGenerator.cpp.
References Curlys, and WrapInParensOrCurlys().
Referenced by InsertCXXMethodDecl().
|
protected |
Definition at line 5211 of file CodeGenerator.cpp.
References Parens, and WrapInParensOrCurlys().
Referenced by clang::insights::CfrontCodeGenerator::InsertArg(), InsertCXXMethodHeader(), InsertFunctionNameWithReturnType(), and InsertLambdaStaticInvoker().
|
protected |
Definition at line 5217 of file CodeGenerator.cpp.
References Parens, and WrapInParensOrCurlys().
Referenced by InsertArgWithParensIfNeeded().
|
protected |
Definition at line 5152 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), Curlys, and mOutputFormatHelper.
Referenced by InsertConstructorExpr(), InsertCXXMethodHeader(), WrapInCurliesIfNeeded(), WrapInCurlys(), WrapInParens(), and WrapInParensIfNeeded().
|
friend |
Definition at line 102 of file CodeGenerator.h.
|
staticconstexprprotected |
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().
|
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().
|
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().
|
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.
|
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().
|
protected |
Definition at line 443 of file CodeGenerator.h.
Referenced by HandleLambdaExpr().
|
protected |
Definition at line 436 of file CodeGenerator.h.
|
protected |
Definition at line 430 of file CodeGenerator.h.
Referenced by HandleCompoundStmt(), HandleLambdaExpr(), clang::insights::CfrontCodeGenerator::InsertArg(), InsertConstructorExpr(), InsertCXXMethodHeader(), and InsideDecltype().
|
protected |
Definition at line 429 of file CodeGenerator.h.
| const Decl* clang::insights::CodeGenerator::mLastDecl {} |
Definition at line 98 of file CodeGenerator.h.
Referenced by clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), and InsertArg().
|
protected |
Definition at line 95 of file CodeGenerator.h.
Referenced by clang::insights::CfrontCodeGenerator::InsertArg().
|
protected |
Definition at line 94 of file CodeGenerator.h.
Referenced by clang::insights::CfrontCodeGenerator::InsertArg(), and InsertArg().
|
protected |
Definition at line 93 of file CodeGenerator.h.
Referenced by EndLifetimeScope(), InsertMethodBody(), LifetimeAddExtended(), and StartLifetimeScope().
|
protected |
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.
|
protected |
Definition at line 104 of file CodeGenerator.h.
Referenced by EndLifetimeScope(), ForEachArg(), FormatCast(), clang::insights::CfrontCodeGenerator::FormatCast(), HandleCompoundStmt(), HandleLocalStaticNonTrivialClass(), clang::insights::ArrayInitCodeGenerator::InsertArg(), clang::insights::StructuredBindingsCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::UsingCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::LambdaCodeGenerator::InsertArg(), InsertArg(), clang::insights::StructuredBindingsCodeGenerator::InsertArg(), clang::insights::LambdaInitCaptureCodeGenerator::InsertArg(), clang::insights::UsingCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::LambdaNameOnlyCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), InsertAttribute(), InsertAttributes(), InsertConceptConstraint(), InsertConceptConstraint(), InsertConstructorExpr(), clang::insights::CoroutinesCodeGenerator::InsertCoroutine(), InsertCurlysIfRequired(), clang::insights::CfrontCodeGenerator::InsertCXXMethodDecl(), InsertCXXMethodDecl(), InsertCXXMethodHeader(), InsertFunctionNameWithReturnType(), InsertIfOrSwitchInitVariables(), InsertInstantiationPoint(), InsertLambdaStaticInvoker(), InsertMethodBody(), InsertNamespace(), InsertQualifierAndName(), InsertQualifierAndNameWithTemplateArgs(), InsertSuffix(), InsertTemplate(), InsertTemplateArg(), InsertTemplateArgs(), InsertTemplateArgsObjectParam(), InsertTemplateGuardBegin(), InsertTemplateGuardEnd(), InsertTemplateParameters(), InsertTemplateSpecializationHeader(), ParseDeclContext(), UpdateCurrentPos(), WrapInCompoundIfNeeded(), WrapInParensOrCurlys(), clang::insights::CoroutinesCodeGenerator::~CoroutinesCodeGenerator(), and clang::insights::MultiStmtDeclCodeGenerator::~MultiStmtDeclCodeGenerator().
|
protected |
Helper output buffer for std::initializer_list expansion.
Definition at line 455 of file CodeGenerator.h.
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 459 of file CodeGenerator.h.
Referenced by HandleLambdaExpr(), InsertCXXMethodHeader(), InsertMethodBody(), and InsertTemplate().
|
protected |
Definition at line 101 of file CodeGenerator.h.
|
protected |
Track whether this is a function with an imlpicit return 0.
Definition at line 457 of file CodeGenerator.h.
Referenced by InsertMethodBody().
|
inlinestaticprotected |
Definition at line 460 of file CodeGenerator.h.
Referenced by InsertTemplateArgsObjectParam().
|
protected |
Definition at line 438 of file CodeGenerator.h.
|
protected |
Definition at line 458 of file CodeGenerator.h.
Referenced by EndLifetimeScope(), and HandleCompoundStmt().
|
protected |
Definition at line 439 of file CodeGenerator.h.
|
protected |
Definition at line 440 of file CodeGenerator.h.