r285287 - Add const versions of Expr::getInits() and Expr::inits()
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 27 09:36:05 PDT 2016
On 27 Oct 2016 5:21 am, "Erik Verbruggen via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:
Author: erikjv
Date: Thu Oct 27 07:12:08 2016
New Revision: 285287
URL: http://llvm.org/viewvc/llvm-project?rev=285287&view=rev
Log:
Add const versions of Expr::getInits() and Expr::inits()
Modified:
cfe/trunk/include/clang/AST/Expr.h
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
clang/AST/Expr.h?rev=285287&r1=285286&r2=285287&view=diff
============================================================
==================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Oct 27 07:12:08 2016
@@ -3783,10 +3783,19 @@ public:
/// \brief Retrieve the set of initializers.
Expr **getInits() { return reinterpret_cast<Expr **>(InitExprs.data()); }
Is anyone actually storing through this? Can we remove the non-const
version?
+ /// \brief Retrieve the set of initializers.
+ Expr * const *getInits() const {
+ return reinterpret_cast<Expr * const *>(InitExprs.data());
+ }
+
ArrayRef<Expr *> inits() {
return llvm::makeArrayRef(getInits(), getNumInits());
}
+ ArrayRef<Expr *> inits() const {
+ return llvm::makeArrayRef(getInits(), getNumInits());
+ }
We don't need the non-const version here.
+
const Expr *getInit(unsigned Init) const {
assert(Init < getNumInits() && "Initializer access out of range!");
return cast_or_null<Expr>(InitExprs[Init]);
_______________________________________________
cfe-commits mailing list
cfe-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161027/6e05fdc9/attachment.html>
More information about the cfe-commits
mailing list