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


Classes | |
| class | LambdaHelper |
| class | LambdaScopeHandler |
Public Member Functions | |
| constexpr | CodeGenerator (OutputFormatHelper &_outputFormatHelper) |
| ! We do not want to transform a primary template which contains a Coroutine. | |
| 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 , CallExpr , OperatorCallExpr , MemberCallExpr , ReturnStmt , BinaryOperator , CXXMethodDecl , LambdaExpr , Decltype , DecltypeWithName } |
| enum class | BraceKind { Parens , Curlys } |
| using | LambdaStackType = StackList< class LambdaHelper > |
Protected Member Functions | |
| STRONG_BOOL (ProcessingPrimaryTemplate) | |
| 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) |
| 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 |
| 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 155 of file CodeGenerator.h.
|
strongprotected |
| Enumerator | |
|---|---|
| Parens | |
| Curlys | |
Definition at line 353 of file CodeGenerator.h.
|
strongprotected |
| Enumerator | |
|---|---|
| VarDecl | |
| CallExpr | |
| OperatorCallExpr | |
| MemberCallExpr | |
| ReturnStmt | |
| BinaryOperator | |
| CXXMethodDecl | |
| LambdaExpr | |
| Decltype | |
| DecltypeWithName | |
Definition at line 106 of file CodeGenerator.h.
|
inlineexplicitconstexpr |
! We do not want to transform a primary template which contains a Coroutine.
Definition at line 161 of file CodeGenerator.h.
|
inlineconstexpr |
Definition at line 166 of file CodeGenerator.h.
|
virtualdefault |
| void clang::insights::CodeGenerator::EndLifetimeScope | ( | ) |
Definition at line 1164 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 1907 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 282 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 4281 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 2972 of file CodeGenerator.cpp.
References clang::insights::Error(), FillConstantArray(), GetValueOfValueInit(), kwFalse, and kwNullptr.
Referenced by GetValueOfValueInit().
|
protected |
Definition at line 2469 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), StackList< T >::empty(), InsertArg(), InsertSemi(), clang::insights::IsStmtRequiringSemi(), mLambdaStack, mOutputFormatHelper, and mSkipSemi.
|
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 4412 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 4342 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::LambdaNameOnlyCodeGenerator, clang::insights::MultiStmtDeclCodeGenerator, clang::insights::CoroutinesCodeGenerator, and clang::insights::CfrontCodeGenerator.
Definition at line 4240 of file CodeGenerator.cpp.
References mLastDecl, mOutputFormatHelper, and clang::insights::ToDo().
Referenced by clang::insights::EmitGlobalVariableCtors(), FormatCast(), clang::insights::GetNoExcept(), HandleCompoundStmt(), HandleLocalStaticNonTrivialClass(), clang::insights::StructuredBindingsCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), clang::insights::UsingCodeGenerator::InsertArg(), clang::insights::CfrontCodeGenerator::InsertArg(), clang::insights::CoroutinesCodeGenerator::InsertArg(), InsertArgWithParensIfNeeded(), InsertConceptConstraint(), InsertCurlysIfRequired(), InsertCXXMethodHeader(), clang::insights::StructuredBindingsCodeGenerator::InsertDecompositionBindings(), 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::LambdaNameOnlyCodeGenerator, clang::insights::MultiStmtDeclCodeGenerator, clang::insights::CoroutinesCodeGenerator, and clang::insights::CfrontCodeGenerator.
Definition at line 4258 of file CodeGenerator.cpp.
References clang::insights::DPrint(), mLastStmt, mOutputFormatHelper, and clang::insights::ToDo().
|
protected |
Definition at line 4297 of file CodeGenerator.cpp.
References InsertArg(), and WrapInParensIfNeeded().
| void clang::insights::CodeGenerator::InsertAttribute | ( | const Attr & | attr | ) |
Definition at line 3749 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 3730 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 3740 of file CodeGenerator.cpp.
References InsertAttribute().
|
inlineprotectedvirtual |
Reimplemented in clang::insights::MultiStmtDeclCodeGenerator.
Definition at line 258 of file CodeGenerator.h.
|
protected |
Definition at line 4664 of file CodeGenerator.cpp.
References InsertConceptConstraint().
|
protected |
Definition at line 4634 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 4653 of file CodeGenerator.cpp.
References InsertConceptConstraint().
|
protected |
Definition at line 4684 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 1991 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), CONDITIONAL_LAMBDA_SCOPE_HELPER, Curlys, Decltype, ForEachArg(), clang::insights::GetName(), InsideDecltype(), mOutputFormatHelper, Parens, 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 4946 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), InsertArg(), and mOutputFormatHelper.
Referenced by InsertCXXMethodHeader().
|
protectedvirtual |
Definition at line 3245 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 3164 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 4696 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 2497 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), InsertArg(), and mOutputFormatHelper.
|
protected |
Inserts the instantiation point of a template.
Definition at line 1521 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendCommentNewLine(), and mOutputFormatHelper.
Referenced by clang::insights::CoroutinesCodeGenerator::InsertArg(), and InsertTemplateGuardBegin().
|
protected |
Definition at line 1469 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 1606 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 260 of file CodeGenerator.h.
Referenced by InsertFunctionNameWithReturnType(), and InsertTemplateArg().
|
protected |
Definition at line 368 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), clang::insights::GetNestedName(), mOutputFormatHelper, and clang::insights::ScopeHandler::RemoveCurrentScope().
|
protected |
Definition at line 358 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 300 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 259 of file CodeGenerator.h.
Referenced by HandleCompoundStmt().
|
protected |
Definition at line 4313 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::Append(), GetBuiltinTypeSuffix(), and mOutputFormatHelper.
|
protected |
Definition at line 3680 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendNewLine(), DecltypeWithName, InsertArg(), LAMBDA_SCOPE_HELPER, mOutputFormatHelper, mProcessingPrimaryTemplate, and RETURN_IF.
| void clang::insights::CodeGenerator::InsertTemplateArg | ( | const TemplateArgument & | arg | ) |
Definition at line 4348 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 287 of file CodeGenerator.h.
References InsertTemplateArg().
Referenced by InsertTemplateArg().
|
inline |
Definition at line 227 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 4325 of file CodeGenerator.cpp.
References InsertTemplateArgs().
|
inline |
Definition at line 190 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 1214 of file CodeGenerator.cpp.
References InsertTemplateArgsObjectParam().
Referenced by InsertTemplateArgsObjectParam(), InsertTemplateParameters(), and InsertTemplateSpecializationHeader().
|
protected |
Definition at line 1192 of file CodeGenerator.cpp.
References clang::insights::OutputFormatHelper::AppendSemiNewLine(), GetGlobalAST(), clang::insights::GetName(), mOutputFormatHelper, and mSeenDecls.
|
protected |
Definition at line 1540 of file CodeGenerator.cpp.
References clang::insights::GetSM(), clang::insights::OutputFormatHelper::InsertIfDefTemplateGuard(), InsertInstantiationPoint(), and mOutputFormatHelper.
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 1549 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 1753 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 1226 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 256 of file CodeGenerator.h.
|
protected |
Definition at line 2110 of file CodeGenerator.cpp.
References StackList< T >::back(), clang::insights::CodeGenerator::LambdaHelper::callerType(), Decltype, StackList< T >::empty(), and mLambdaStack.
Referenced by InsertConstructorExpr().
| void clang::insights::CodeGenerator::LifetimeAddExtended | ( | const VarDecl * | vd, |
| const ValueDecl * | extending | ||
| ) |
Definition at line 1152 of file CodeGenerator.cpp.
References clang::insights::LifetimeTracker::AddExtended(), and mLifeTimeTracker.
Referenced by clang::insights::TemporaryDeclFinder::VisitMaterializeTemporaryExpr().
|
protected |
Definition at line 3544 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 265 of file CodeGenerator.h.
|
inlineprotectedvirtual |
Reimplemented in clang::insights::CoroutinesCodeGenerator.
Definition at line 257 of file CodeGenerator.h.
| void clang::insights::CodeGenerator::StartLifetimeScope | ( | ) |
Definition at line 1158 of file CodeGenerator.cpp.
References mLifeTimeTracker, and clang::insights::LifetimeTracker::StartScope().
Referenced by clang::insights::TemporaryDeclFinder::VisitMaterializeTemporaryExpr().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| clang::insights::CodeGenerator::STRONG_BOOL | ( | TemplateParamsOnly | ) |
|
protected |
|
inlineprotected |
Definition at line 375 of file CodeGenerator.h.
References clang::insights::OutputFormatHelper::CurrentPos(), and mOutputFormatHelper.
|
protected |
Definition at line 4987 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 5040 of file CodeGenerator.cpp.
References Curlys, and WrapInParensOrCurlys().
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 5052 of file CodeGenerator.cpp.
References Curlys, and WrapInParensOrCurlys().
Referenced by InsertCXXMethodDecl().
|
protected |
Definition at line 5022 of file CodeGenerator.cpp.
References Parens, and WrapInParensOrCurlys().
Referenced by clang::insights::CfrontCodeGenerator::InsertArg(), InsertCXXMethodHeader(), InsertFunctionNameWithReturnType(), and InsertLambdaStaticInvoker().
|
protected |
Definition at line 5028 of file CodeGenerator.cpp.
References Parens, and WrapInParensOrCurlys().
Referenced by InsertArgWithParensIfNeeded().
|
protected |
Definition at line 4963 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 414 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 419 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 423 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 421 of file CodeGenerator.h.
|
protected |
The position in mOutputFormatHelper where a potential std::initializer_list expansion must be inserted.
Definition at line 417 of file CodeGenerator.h.
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 413 of file CodeGenerator.h.
|
protected |
Definition at line 401 of file CodeGenerator.h.
Referenced by HandleCompoundStmt(), clang::insights::CfrontCodeGenerator::InsertArg(), InsertCXXMethodHeader(), and InsideDecltype().
|
protected |
Definition at line 400 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 411 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(), InsertArg(), clang::insights::StructuredBindingsCodeGenerator::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 425 of file CodeGenerator.h.
Referenced by InsertCXXMethodHeader().
|
protected |
Definition at line 429 of file CodeGenerator.h.
Referenced by 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 427 of file CodeGenerator.h.
Referenced by InsertMethodBody().
|
inlinestaticprotected |
Definition at line 430 of file CodeGenerator.h.
Referenced by InsertTemplateArgsObjectParam().
|
protected |
Definition at line 408 of file CodeGenerator.h.
|
protected |
Definition at line 428 of file CodeGenerator.h.
Referenced by EndLifetimeScope(), and HandleCompoundStmt().
|
protected |
Definition at line 409 of file CodeGenerator.h.
|
protected |
Definition at line 410 of file CodeGenerator.h.