]> granicus.if.org Git - clang/blob - AST/ExprCXX.cpp
add parsing, ast building and pretty printing support for C++ throw expressions.
[clang] / AST / ExprCXX.cpp
1 //===--- ExprCXX.cpp - (C++) Expression AST Node Implementation -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the subclesses of Expr class declared in ExprCXX.h
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "clang/AST/ExprCXX.h"
15 using namespace clang;
16
17 //===----------------------------------------------------------------------===//
18 //  Child Iterators for iterating over subexpressions/substatements
19 //===----------------------------------------------------------------------===//
20
21
22 // CXXCastExpr
23 Stmt::child_iterator CXXCastExpr::child_begin() {
24   return reinterpret_cast<Stmt**>(&Op);
25 }
26 Stmt::child_iterator CXXCastExpr::child_end() {
27   return reinterpret_cast<Stmt**>(&Op)+1;
28 }
29
30 // CXXBoolLiteralExpr
31 Stmt::child_iterator CXXBoolLiteralExpr::child_begin() { 
32   return child_iterator();
33 }
34 Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
35   return child_iterator();
36 }
37
38 // CXXThrowExpr
39 Stmt::child_iterator CXXThrowExpr::child_begin() {
40   return reinterpret_cast<Stmt**>(&Op);
41 }
42 Stmt::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 }