struct ComplexRemove
Declaration
struct ComplexRemove : public TreeTransform { /* full declaration omitted */ };
Description
A semantic tree transformation that allows one to transform one abstract syntax tree into another. A new tree transformation is defined by creating a new subclass \c X of\c TreeTransform<X> and then overriding certain operations to provide behavior specific to that transformation. For example, template instantiation is implemented as a tree transformation where the transformation of TemplateTypeParmType nodes involves substituting the template arguments for their corresponding template parameters; a similar transformation is performed for non-type template parameters and template template parameters. This tree-transformation template uses static polymorphism to allow subclasses to customize any of its operations. Thus, a subclass can override any of the transformation or rebuild operators by providing an operation with the same signature as the default implementation. The overriding function should not be virtual. Semantic tree transformations are split into two stages, either of which can be replaced by a subclass. The "transform" step transforms an AST node or the parts of an AST node using the various transformation functions, then passes the pieces on to the "rebuild" step, which constructs a new AST node of the appropriate kind from the pieces. The default transformation routines recursively transform the operands to composite AST nodes (e.g., the pointee type of a PointerType node) and, if any of those operand nodes were changed by the transformation, invokes the rebuild operation to create a new AST node. Subclasses can customize the transformation at various levels. The most coarse-grained transformations involve replacing TransformType(), TransformExpr(), TransformDecl(), TransformNestedNameSpecifierLoc(), TransformTemplateName(), or TransformTemplateArgument() with entirely new implementations. For more fine-grained transformations, subclasses can replace any of the\c TransformXXX functions (where XXX is the name of an AST node, e.g., PointerType, StmtExpr) to alter the transformation. As mentioned previously, replacing TransformTemplateTypeParmType() allows template instantiation to substitute template arguments for their corresponding template parameters. Additionally, subclasses can override the \c RebuildXXX functions to control how AST nodes are rebuilt when their operands change. By default, \c TreeTransform will invoke semantic analysis to rebuild AST nodes. However, certain other tree transformations (e.g, cloning) may be able to use more efficient rebuild steps. There are a handful of other functions that can be overridden, allowing one to avoid traversing nodes that don't need any transformation (\c AlreadyTransformed()), force rebuilding AST nodes even when their operands have not changed (\c AlwaysRebuild()), and customize the default locations and entity names used for type-checking (\c getBaseLocation(), \c getBaseEntity()).
Declared at: clang/lib/Sema/SemaExpr.cpp:17554
Inherits from: TreeTransform
Member Variables
- public llvm::SmallPtrSetImpl<DeclRefExpr*>& DRSet
- public SmallVector<Sema::ImmediateInvocationCandidate, 4>& IISet
- public SmallVector<Sema::ImmediateInvocationCandidate, 4>::reverse_iterator CurrentII
- public bool AllowSkippingFirstCXXConstructExpr = true
Method Overview
- public bool AllowSkippingCXXConstructExpr()
- public bool AlwaysRebuild()
- public ComplexRemove(clang::Sema & SemaRef, llvm::SmallPtrSetImpl<DeclRefExpr *> & DR, SmallVector<Sema::ImmediateInvocationCandidate, 4> & II, SmallVector<Sema::ImmediateInvocationCandidate, 4>::reverse_iterator Current)
- public void RemoveImmediateInvocation(clang::ConstantExpr * E)
- public bool ReplacingOriginal()
- public clang::ExprResult TransformCXXOperatorCallExpr(clang::CXXOperatorCallExpr * E)
- public clang::ExprResult TransformConstantExpr(clang::ConstantExpr * E)
- public clang::ExprResult TransformDeclRefExpr(clang::DeclRefExpr * E)
- public clang::ExprResult TransformInitializer(clang::Expr * Init, bool NotCopyInit)
- public clang::ExprResult TransformLambdaExpr(clang::LambdaExpr * E)
Methods
¶bool AllowSkippingCXXConstructExpr()
bool AllowSkippingCXXConstructExpr()
Declared at: clang/lib/Sema/SemaExpr.cpp:17610
¶bool AlwaysRebuild()
bool AlwaysRebuild()
Declared at: clang/lib/Sema/SemaExpr.cpp:17608
¶ComplexRemove(
clang::Sema& SemaRef,
llvm::SmallPtrSetImpl<DeclRefExpr*>& DR,
SmallVector<
Sema::ImmediateInvocationCandidate,
4>& II,
SmallVector<
Sema::ImmediateInvocationCandidate,
4>::reverse_iterator Current)
ComplexRemove(
clang::Sema& SemaRef,
llvm::SmallPtrSetImpl<DeclRefExpr*>& DR,
SmallVector<
Sema::ImmediateInvocationCandidate,
4>& II,
SmallVector<
Sema::ImmediateInvocationCandidate,
4>::reverse_iterator Current)
Declared at: clang/lib/Sema/SemaExpr.cpp:17560
Parameters
- clang::Sema& SemaRef
- llvm::SmallPtrSetImpl<DeclRefExpr*>& DR
- SmallVector<Sema::ImmediateInvocationCandidate, 4>& II
- SmallVector<Sema::ImmediateInvocationCandidate, 4>::reverse_iterator Current
¶void RemoveImmediateInvocation(
clang::ConstantExpr* E)
void RemoveImmediateInvocation(
clang::ConstantExpr* E)
Declared at: clang/lib/Sema/SemaExpr.cpp:17565
Parameters
¶bool ReplacingOriginal()
bool ReplacingOriginal()
Declared at: clang/lib/Sema/SemaExpr.cpp:17609
¶clang::ExprResult TransformCXXOperatorCallExpr(
clang::CXXOperatorCallExpr* E)
clang::ExprResult TransformCXXOperatorCallExpr(
clang::CXXOperatorCallExpr* E)
Description
Base::TransfromCXXOperatorCallExpr doesn't traverse the callee so we need to remove its DeclRefExpr from the DRSet.
Declared at: clang/lib/Sema/SemaExpr.cpp:17583
Parameters
¶clang::ExprResult TransformConstantExpr(
clang::ConstantExpr* E)
clang::ExprResult TransformConstantExpr(
clang::ConstantExpr* E)
Declared at: clang/lib/Sema/SemaExpr.cpp:17575
Parameters
¶clang::ExprResult TransformDeclRefExpr(
clang::DeclRefExpr* E)
clang::ExprResult TransformDeclRefExpr(
clang::DeclRefExpr* E)
Declared at: clang/lib/Sema/SemaExpr.cpp:17599
Parameters
¶clang::ExprResult TransformInitializer(
clang::Expr* Init,
bool NotCopyInit)
clang::ExprResult TransformInitializer(
clang::Expr* Init,
bool NotCopyInit)
Description
Base::TransformInitializer skip ConstantExpr so we need to visit them here.
Declared at: clang/lib/Sema/SemaExpr.cpp:17589
Parameters
- clang::Expr* Init
- bool NotCopyInit
¶clang::ExprResult TransformLambdaExpr(
clang::LambdaExpr* E)
clang::ExprResult TransformLambdaExpr(
clang::LambdaExpr* E)
Declared at: clang/lib/Sema/SemaExpr.cpp:17603