@@ -746,67 +746,110 @@ class Expr : public Stmt {
746
746
// / member expression.
747
747
static QualType findBoundMemberType (const Expr *expr);
748
748
749
- // / IgnoreImpCasts - Skip past any implicit casts which might
750
- // / surround this expression. Only skips ImplicitCastExprs.
749
+ // / Skip past any implicit casts which might surround this expression until
750
+ // / reaching a fixed point. Skips:
751
+ // / * ImplicitCastExpr
752
+ // / * FullExpr
751
753
Expr *IgnoreImpCasts () LLVM_READONLY;
752
-
753
- // / IgnoreImplicit - Skip past any implicit AST nodes which might
754
- // / surround this expression.
755
- Expr *IgnoreImplicit () LLVM_READONLY {
756
- return cast<Expr>(Stmt::IgnoreImplicit ());
757
- }
758
-
759
- const Expr *IgnoreImplicit () const LLVM_READONLY {
760
- return const_cast <Expr*>(this )->IgnoreImplicit ();
754
+ const Expr *IgnoreImpCasts () const {
755
+ return const_cast <Expr *>(this )->IgnoreImpCasts ();
761
756
}
762
757
763
- // / IgnoreParens - Ignore parentheses. If this Expr is a ParenExpr, return
764
- // / its subexpression. If that subexpression is also a ParenExpr,
765
- // / then this method recursively returns its subexpression, and so forth.
766
- // / Otherwise, the method returns the current Expr.
767
- Expr *IgnoreParens () LLVM_READONLY;
768
-
769
- // / IgnoreParenCasts - Ignore parentheses and casts. Strip off any ParenExpr
770
- // / or CastExprs, returning their operand.
771
- Expr *IgnoreParenCasts () LLVM_READONLY;
772
-
773
- // / Ignore casts. Strip off any CastExprs, returning their operand.
758
+ // / Skip past any casts which might surround this expression until reaching
759
+ // / a fixed point. Skips:
760
+ // / * CastExpr
761
+ // / * FullExpr
762
+ // / * MaterializeTemporaryExpr
763
+ // / * SubstNonTypeTemplateParmExpr
774
764
Expr *IgnoreCasts () LLVM_READONLY;
775
-
776
- // / IgnoreParenImpCasts - Ignore parentheses and implicit casts. Strip off
777
- // / any ParenExpr or ImplicitCastExprs, returning their operand.
765
+ const Expr *IgnoreCasts () const {
766
+ return const_cast <Expr *>(this )->IgnoreCasts ();
767
+ }
768
+
769
+ // / Skip past any implicit AST nodes which might surround this expression
770
+ // / until reaching a fixed point. Skips:
771
+ // / * What IgnoreImpCasts() skips
772
+ // / * MaterializeTemporaryExpr
773
+ // / * CXXBindTemporaryExpr
774
+ Expr *IgnoreImplicit () LLVM_READONLY;
775
+ const Expr *IgnoreImplicit () const {
776
+ return const_cast <Expr *>(this )->IgnoreImplicit ();
777
+ }
778
+
779
+ // / Skip past any parentheses which might surround this expression until
780
+ // / reaching a fixed point. Skips:
781
+ // / * ParenExpr
782
+ // / * UnaryOperator if `UO_Extension`
783
+ // / * GenericSelectionExpr if `!isResultDependent()`
784
+ // / * ChooseExpr if `!isConditionDependent()`
785
+ // / * ConstantExpr
786
+ Expr *IgnoreParens () LLVM_READONLY;
787
+ const Expr *IgnoreParens () const {
788
+ return const_cast <Expr *>(this )->IgnoreParens ();
789
+ }
790
+
791
+ // / Skip past any parentheses and implicit casts which might surround this
792
+ // / expression until reaching a fixed point.
793
+ // / FIXME: IgnoreParenImpCasts really ought to be equivalent to
794
+ // / IgnoreParens() + IgnoreImpCasts() until reaching a fixed point. However
795
+ // / this is currently not the case. Instead IgnoreParenImpCasts() skips:
796
+ // / * What IgnoreParens() skips
797
+ // / * ImplicitCastExpr
798
+ // / * MaterializeTemporaryExpr
799
+ // / * SubstNonTypeTemplateParmExpr
778
800
Expr *IgnoreParenImpCasts () LLVM_READONLY;
779
-
780
- // / IgnoreConversionOperator - Ignore conversion operator. If this Expr is a
781
- // / call to a conversion operator, return the argument.
782
- Expr *IgnoreConversionOperator () LLVM_READONLY;
783
-
784
- const Expr *IgnoreConversionOperator () const LLVM_READONLY {
785
- return const_cast <Expr*>(this )->IgnoreConversionOperator ();
801
+ const Expr *IgnoreParenImpCasts () const {
802
+ return const_cast <Expr *>(this )->IgnoreParenImpCasts ();
786
803
}
787
804
788
- const Expr *IgnoreParenImpCasts () const LLVM_READONLY {
789
- return const_cast <Expr*>(this )->IgnoreParenImpCasts ();
805
+ // / Skip past any parentheses and casts which might surround this expression
806
+ // / until reaching a fixed point. Skips:
807
+ // / * What IgnoreParens() skips
808
+ // / * What IgnoreCasts() skips
809
+ Expr *IgnoreParenCasts () LLVM_READONLY;
810
+ const Expr *IgnoreParenCasts () const {
811
+ return const_cast <Expr *>(this )->IgnoreParenCasts ();
790
812
}
791
813
792
- // / Ignore parentheses and lvalue casts. Strip off any ParenExpr and
793
- // / CastExprs that represent lvalue casts, returning their operand.
814
+ // / Skip conversion operators. If this Expr is a call to a conversion
815
+ // / operator, return the argument.
816
+ Expr *IgnoreConversionOperator () LLVM_READONLY;
817
+ const Expr *IgnoreConversionOperator () const {
818
+ return const_cast <Expr *>(this )->IgnoreConversionOperator ();
819
+ }
820
+
821
+ // / Skip past any parentheses and lvalue casts which might surround this
822
+ // / expression until reaching a fixed point. Skips:
823
+ // / * What IgnoreParens() skips
824
+ // / * What IgnoreCasts() skips, except that only lvalue-to-rvalue
825
+ // / casts are skipped
826
+ // / FIXME: This is intended purely as a temporary workaround for code
827
+ // / that hasn't yet been rewritten to do the right thing about those
828
+ // / casts, and may disappear along with the last internal use.
794
829
Expr *IgnoreParenLValueCasts () LLVM_READONLY;
795
-
796
- const Expr *IgnoreParenLValueCasts () const LLVM_READONLY {
797
- return const_cast <Expr*>(this )->IgnoreParenLValueCasts ();
798
- }
799
-
800
- // / IgnoreParenNoopCasts - Ignore parentheses and casts that do not change the
801
- // / value (including ptr->int casts of the same size). Strip off any
802
- // / ParenExpr or CastExprs, returning their operand.
803
- Expr *IgnoreParenNoopCasts (ASTContext &Ctx) LLVM_READONLY;
804
-
805
- // / Ignore parentheses and derived-to-base casts.
830
+ const Expr *IgnoreParenLValueCasts () const {
831
+ return const_cast <Expr *>(this )->IgnoreParenLValueCasts ();
832
+ }
833
+
834
+ // / Skip past any parenthese and casts which do not change the value
835
+ // / (including ptr->int casts of the same size) until reaching a fixed point.
836
+ // / Skips:
837
+ // / * What IgnoreParens() skips
838
+ // / * CastExpr which do not change the value
839
+ // / * SubstNonTypeTemplateParmExpr
840
+ Expr *IgnoreParenNoopCasts (const ASTContext &Ctx) LLVM_READONLY;
841
+ const Expr *IgnoreParenNoopCasts (const ASTContext &Ctx) const {
842
+ return const_cast <Expr *>(this )->IgnoreParenNoopCasts (Ctx);
843
+ }
844
+
845
+ // / Skip past any parentheses and derived-to-base casts until reaching a
846
+ // / fixed point. Skips:
847
+ // / * What IgnoreParens() skips
848
+ // / * CastExpr which represent a derived-to-base cast (CK_DerivedToBase,
849
+ // / CK_UncheckedDerivedToBase and CK_NoOp)
806
850
Expr *ignoreParenBaseCasts () LLVM_READONLY;
807
-
808
- const Expr *ignoreParenBaseCasts () const LLVM_READONLY {
809
- return const_cast <Expr*>(this )->ignoreParenBaseCasts ();
851
+ const Expr *ignoreParenBaseCasts () const {
852
+ return const_cast <Expr *>(this )->ignoreParenBaseCasts ();
810
853
}
811
854
812
855
// / Determine whether this expression is a default function argument.
@@ -825,24 +868,6 @@ class Expr : public Stmt {
825
868
// / Whether this expression is an implicit reference to 'this' in C++.
826
869
bool isImplicitCXXThis () const ;
827
870
828
- const Expr *IgnoreImpCasts () const LLVM_READONLY {
829
- return const_cast <Expr*>(this )->IgnoreImpCasts ();
830
- }
831
- const Expr *IgnoreParens () const LLVM_READONLY {
832
- return const_cast <Expr*>(this )->IgnoreParens ();
833
- }
834
- const Expr *IgnoreParenCasts () const LLVM_READONLY {
835
- return const_cast <Expr*>(this )->IgnoreParenCasts ();
836
- }
837
- // / Strip off casts, but keep parentheses.
838
- const Expr *IgnoreCasts () const LLVM_READONLY {
839
- return const_cast <Expr*>(this )->IgnoreCasts ();
840
- }
841
-
842
- const Expr *IgnoreParenNoopCasts (ASTContext &Ctx) const LLVM_READONLY {
843
- return const_cast <Expr*>(this )->IgnoreParenNoopCasts (Ctx);
844
- }
845
-
846
871
static bool hasAnyTypeDependentArguments (ArrayRef<Expr *> Exprs);
847
872
848
873
// / For an expression of class type or pointer to class type,
@@ -3167,18 +3192,6 @@ class ImplicitCastExpr final
3167
3192
friend class CastExpr ;
3168
3193
};
3169
3194
3170
- inline Expr *Expr::IgnoreImpCasts () {
3171
- Expr *e = this ;
3172
- while (true )
3173
- if (ImplicitCastExpr *ice = dyn_cast<ImplicitCastExpr>(e))
3174
- e = ice->getSubExpr ();
3175
- else if (FullExpr *fe = dyn_cast<FullExpr>(e))
3176
- e = fe->getSubExpr ();
3177
- else
3178
- break ;
3179
- return e;
3180
- }
3181
-
3182
3195
// / ExplicitCastExpr - An explicit cast written in the source
3183
3196
// / code.
3184
3197
// /
0 commit comments