13#ifndef LLVM_CLANG_AST_IGNOREEXPR_H
14#define LLVM_CLANG_AST_IGNOREEXPR_H
24template <
typename FnTy,
typename... FnTys>
27 std::forward<FnTys>(Fns)...);
35 Expr *LastE =
nullptr;
43template <
typename... FnTys>
49 if (
auto *ICE = dyn_cast<ImplicitCastExpr>(
E))
50 return ICE->getSubExpr();
52 if (
auto *FE = dyn_cast<FullExpr>(
E))
53 return FE->getSubExpr();
66 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(
E))
67 return MTE->getSubExpr();
69 if (
auto *NTTP = dyn_cast<SubstNonTypeTemplateParmExpr>(
E))
70 return NTTP->getReplacement();
76 if (
auto *CE = dyn_cast<CastExpr>(
E))
77 return CE->getSubExpr();
79 if (
auto *FE = dyn_cast<FullExpr>(
E))
80 return FE->getSubExpr();
82 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(
E))
83 return MTE->getSubExpr();
85 if (
auto *NTTP = dyn_cast<SubstNonTypeTemplateParmExpr>(
E))
86 return NTTP->getReplacement();
94 if (
auto *CE = dyn_cast<CastExpr>(
E))
95 if (CE->getCastKind() != CK_LValueToRValue)
102 if (
auto *CE = dyn_cast<CastExpr>(
E))
103 if (CE->getCastKind() == CK_DerivedToBase ||
104 CE->getCastKind() == CK_UncheckedDerivedToBase ||
105 CE->getCastKind() == CK_NoOp)
106 return CE->getSubExpr();
116 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(
E))
117 return MTE->getSubExpr();
119 if (
auto *BTE = dyn_cast<CXXBindTemporaryExpr>(
E))
120 return BTE->getSubExpr();
126 auto *CCE = dyn_cast<CXXConstructExpr>(
E);
127 if (CCE && CCE->isElidable() && !isa<CXXTemporaryObjectExpr>(CCE)) {
128 unsigned NumArgs = CCE->getNumArgs();
130 (NumArgs > 1 && CCE->getArg(1)->isDefaultArgument())) &&
131 !CCE->getArg(0)->isDefaultArgument() && !CCE->isListInitialization())
132 return CCE->getArg(0);
138 if (
auto *ICE = dyn_cast<ImplicitCastExpr>(
E))
139 return ICE->getSubExprAsWritten();
145 if (
auto *PE = dyn_cast<ParenExpr>(
E))
146 return PE->getSubExpr();
151 if (
auto *PE = dyn_cast<ParenExpr>(
E))
152 return PE->getSubExpr();
154 if (
auto *UO = dyn_cast<UnaryOperator>(
E)) {
155 if (UO->getOpcode() == UO_Extension)
156 return UO->getSubExpr();
159 else if (
auto *GSE = dyn_cast<GenericSelectionExpr>(
E)) {
160 if (!GSE->isResultDependent())
161 return GSE->getResultExpr();
164 else if (
auto *CE = dyn_cast<ChooseExpr>(
E)) {
165 if (!CE->isConditionDependent())
166 return CE->getChosenSubExpr();
169 else if (
auto *PE = dyn_cast<PredefinedExpr>(
E)) {
170 if (PE->isTransparent() && PE->getFunctionName())
171 return PE->getFunctionName();
Defines the clang::Expr interface and subclasses for C++ expressions.
This represents one expression.
Expr * IgnoreExprNodesImpl(Expr *E)
Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *, Return Fn_n(....
The JSON file list parser is used to communicate input to InstallAPI.
Expr * IgnoreElidableImplicitConstructorSingleStep(Expr *E)
Expr * IgnoreExprNodes(Expr *E, FnTys &&... Fns)
Given an expression E and functions Fn_1,...,Fn_n : Expr * -> Expr *, Recursively apply each of the f...
Expr * IgnoreImplicitCastsExtraSingleStep(Expr *E)
Expr * IgnoreImplicitCastsSingleStep(Expr *E)
Expr * IgnoreImplicitSingleStep(Expr *E)
Expr * IgnoreParensSingleStep(Expr *E)
Expr * IgnoreImplicitAsWrittenSingleStep(Expr *E)
Expr * IgnoreCastsSingleStep(Expr *E)
Expr * IgnoreLValueCastsSingleStep(Expr *E)
Expr * IgnoreParensOnlySingleStep(Expr *E)
Expr * IgnoreBaseCastsSingleStep(Expr *E)