diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/Expr.h | 9 | ||||
-rw-r--r-- | include/clang/AST/ExprCXX.h | 19 | ||||
-rw-r--r-- | include/clang/AST/ExprObjC.h | 22 |
3 files changed, 37 insertions, 13 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index d2add78cd8..8ed16ad59c 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1694,6 +1694,9 @@ public: /// unsigned getNumArgs() const { return NumArgs; } + /// \brief Retrieve the call arguments. + Expr **getArgs() { return reinterpret_cast<Expr **>(SubExprs + ARGS_START); } + /// getArg - Return the specified argument. Expr *getArg(unsigned Arg) { assert(Arg < NumArgs && "Arg access out of range!"); @@ -2737,6 +2740,9 @@ public: /// pointers. unsigned getNumSubExprs() const { return NumExprs; } + /// \brief Retrieve the array of expressions. + Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); } + /// getExpr - Return the Expr at the specified index. Expr *getExpr(unsigned Index) { assert((Index < NumExprs) && "Arg access out of range!"); @@ -2971,6 +2977,9 @@ public: unsigned getNumInits() const { return InitExprs.size(); } + /// \brief Retrieve the set of initializers. + Expr **getInits() { return reinterpret_cast<Expr **>(InitExprs.data()); } + const Expr *getInit(unsigned Init) const { assert(Init < getNumInits() && "Initializer access out of range!"); return cast_or_null<Expr>(InitExprs[Init]); diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index bd7d3f09c3..5311d9c3a8 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -21,11 +21,11 @@ namespace clang { - class CXXConstructorDecl; - class CXXDestructorDecl; - class CXXMethodDecl; - class CXXTemporary; - class TemplateArgumentListInfo; +class CXXConstructorDecl; +class CXXDestructorDecl; +class CXXMethodDecl; +class CXXTemporary; +class TemplateArgumentListInfo; //===--------------------------------------------------------------------===// // C++ Expressions. @@ -1052,6 +1052,10 @@ public: } unsigned getNumPlacementArgs() const { return NumPlacementArgs; } + Expr **getPlacementArgs() { + return reinterpret_cast<Expr **>(SubExprs + Array); + } + Expr *getPlacementArg(unsigned i) { assert(i < NumPlacementArgs && "Index out of range"); return cast<Expr>(SubExprs[Array + i]); @@ -1070,6 +1074,11 @@ public: void setHasInitializer(bool V) { Initializer = V; } unsigned getNumConstructorArgs() const { return NumConstructorArgs; } + + Expr **getConstructorArgs() { + return reinterpret_cast<Expr **>(SubExprs + Array + NumPlacementArgs); + } + Expr *getConstructorArg(unsigned i) { assert(i < NumConstructorArgs && "Index out of range"); return cast<Expr>(SubExprs[Array + NumPlacementArgs + i]); diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index 0eba6ba9f2..c89d4e34c1 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -746,11 +746,11 @@ public: /// \brief Retrieve the arguments to this message, not including the /// receiver. - Stmt **getArgs() { - return reinterpret_cast<Stmt **>(this + 1) + 1; + Expr **getArgs() { + return reinterpret_cast<Expr **>(this + 1) + 1; } - const Stmt * const *getArgs() const { - return reinterpret_cast<const Stmt * const *>(this + 1) + 1; + const Expr * const *getArgs() const { + return reinterpret_cast<const Expr * const *>(this + 1) + 1; } /// getArg - Return the specified argument. @@ -792,10 +792,16 @@ public: typedef ExprIterator arg_iterator; typedef ConstExprIterator const_arg_iterator; - arg_iterator arg_begin() { return getArgs(); } - arg_iterator arg_end() { return getArgs() + NumArgs; } - const_arg_iterator arg_begin() const { return getArgs(); } - const_arg_iterator arg_end() const { return getArgs() + NumArgs; } + arg_iterator arg_begin() { return reinterpret_cast<Stmt **>(getArgs()); } + arg_iterator arg_end() { + return reinterpret_cast<Stmt **>(getArgs() + NumArgs); + } + const_arg_iterator arg_begin() const { + return reinterpret_cast<Stmt const * const*>(getArgs()); + } + const_arg_iterator arg_end() const { + return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs); + } friend class ASTStmtReader; friend class ASTStmtWriter; |