diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-04-11 20:21:30 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-04-11 20:21:30 +0000 |
commit | 4c54fe0c7bf8cc513509b488252d3e3f74958665 (patch) | |
tree | c0c9b9e572f3edeb1d804a1245586f6780f79e06 /clang/lib/AST/Expr.cpp | |
parent | 554dcd8c89e36d1444d29709cfdf1e043d8923aa (diff) | |
download | bcm5719-llvm-4c54fe0c7bf8cc513509b488252d3e3f74958665.tar.gz bcm5719-llvm-4c54fe0c7bf8cc513509b488252d3e3f74958665.zip |
Add const children() accessors to match the existing non-const children() accessors.
llvm-svn: 299981
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 0fa467f7b7f..d523a0f93cf 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3887,16 +3887,22 @@ PseudoObjectExpr::PseudoObjectExpr(QualType type, ExprValueKind VK, // UnaryExprOrTypeTraitExpr Stmt::child_range UnaryExprOrTypeTraitExpr::children() { + const_child_range CCR = + const_cast<const UnaryExprOrTypeTraitExpr *>(this)->children(); + return child_range(cast_away_const(CCR.begin()), cast_away_const(CCR.end())); +} + +Stmt::const_child_range UnaryExprOrTypeTraitExpr::children() const { // If this is of a type and the type is a VLA type (and not a typedef), the // size expression of the VLA needs to be treated as an executable expression. // Why isn't this weirdness documented better in StmtIterator? if (isArgumentType()) { - if (const VariableArrayType* T = dyn_cast<VariableArrayType>( - getArgumentType().getTypePtr())) - return child_range(child_iterator(T), child_iterator()); - return child_range(child_iterator(), child_iterator()); + if (const VariableArrayType *T = + dyn_cast<VariableArrayType>(getArgumentType().getTypePtr())) + return const_child_range(const_child_iterator(T), const_child_iterator()); + return const_child_range(const_child_iterator(), const_child_iterator()); } - return child_range(&Argument.Ex, &Argument.Ex + 1); + return const_child_range(&Argument.Ex, &Argument.Ex + 1); } AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef<Expr*> args, |