blob: 03faf8b8b510c15195763e327a006271b0812fc1 [file] [log] [blame]
Ted Kremenekfc7b6f72007-08-24 20:21:10 +00001//===--- ExprCXX.cpp - (C++) Expression AST Node Implementation -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner959e5be2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Ted Kremenekfc7b6f72007-08-24 20:21:10 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the subclesses of Expr class declared in ExprCXX.h
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/ExprCXX.h"
15using namespace clang;
16
17//===----------------------------------------------------------------------===//
18// Child Iterators for iterating over subexpressions/substatements
19//===----------------------------------------------------------------------===//
20
21
22// CXXCastExpr
23Stmt::child_iterator CXXCastExpr::child_begin() {
24 return reinterpret_cast<Stmt**>(&Op);
25}
Ted Kremenekfc7b6f72007-08-24 20:21:10 +000026Stmt::child_iterator CXXCastExpr::child_end() {
Ted Kremenek29024022007-10-18 18:17:43 +000027 return reinterpret_cast<Stmt**>(&Op)+1;
Ted Kremenekfc7b6f72007-08-24 20:21:10 +000028}
29
30// CXXBoolLiteralExpr
Ted Kremeneka6478552007-10-18 23:28:49 +000031Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
32 return child_iterator();
33}
34Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
35 return child_iterator();
36}
Chris Lattnera7447ba2008-02-26 00:51:44 +000037
38// CXXThrowExpr
39Stmt::child_iterator CXXThrowExpr::child_begin() {
40 return reinterpret_cast<Stmt**>(&Op);
41}
42Stmt::child_iterator CXXThrowExpr::child_end() {
43 // If Op is 0, we are processing throw; which has no children.
44 if (Op == 0)
45 return reinterpret_cast<Stmt**>(&Op)+0;
46 return reinterpret_cast<Stmt**>(&Op)+1;
47}
Chris Lattner3e254fb2008-04-08 04:40:51 +000048
49// CXXDefaultArgExpr
50Stmt::child_iterator CXXDefaultArgExpr::child_begin() {
51 return reinterpret_cast<Stmt**>(Param->getDefaultArg());
52}
53Stmt::child_iterator CXXDefaultArgExpr::child_end() {
54 return reinterpret_cast<Stmt**>(Param->getDefaultArg())+1;
55}