2007-08-25 04:21:10 +08:00
|
|
|
//===--- ExprCXX.cpp - (C++) Expression AST Node Implementation -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 03:59:25 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-08-25 04:21:10 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the subclesses of Expr class declared in ExprCXX.h
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/AST/ExprCXX.h"
|
|
|
|
using namespace clang;
|
|
|
|
|
2008-09-10 10:14:49 +08:00
|
|
|
void CXXConditionDeclExpr::Destroy(ASTContext& C) {
|
|
|
|
getVarDecl()->Destroy(C);
|
|
|
|
delete this;
|
|
|
|
}
|
2008-09-10 07:47:53 +08:00
|
|
|
|
|
|
|
|
2007-08-25 04:21:10 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Child Iterators for iterating over subexpressions/substatements
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
// CXXBoolLiteralExpr
|
2007-10-19 07:28:49 +08:00
|
|
|
Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
|
|
|
|
return child_iterator();
|
|
|
|
}
|
|
|
|
Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
|
|
|
|
return child_iterator();
|
|
|
|
}
|
2008-02-26 08:51:44 +08:00
|
|
|
|
2008-11-04 22:32:21 +08:00
|
|
|
// CXXThisExpr
|
|
|
|
Stmt::child_iterator CXXThisExpr::child_begin() { return child_iterator(); }
|
|
|
|
Stmt::child_iterator CXXThisExpr::child_end() { return child_iterator(); }
|
|
|
|
|
2008-02-26 08:51:44 +08:00
|
|
|
// CXXThrowExpr
|
2008-06-17 11:11:08 +08:00
|
|
|
Stmt::child_iterator CXXThrowExpr::child_begin() { return &Op; }
|
2008-02-26 08:51:44 +08:00
|
|
|
Stmt::child_iterator CXXThrowExpr::child_end() {
|
|
|
|
// If Op is 0, we are processing throw; which has no children.
|
2008-06-17 11:11:08 +08:00
|
|
|
return Op ? &Op+1 : &Op;
|
2008-02-26 08:51:44 +08:00
|
|
|
}
|
2008-04-08 12:40:51 +08:00
|
|
|
|
|
|
|
// CXXDefaultArgExpr
|
|
|
|
Stmt::child_iterator CXXDefaultArgExpr::child_begin() {
|
2008-04-10 10:22:51 +08:00
|
|
|
return child_iterator();
|
2008-04-08 12:40:51 +08:00
|
|
|
}
|
|
|
|
Stmt::child_iterator CXXDefaultArgExpr::child_end() {
|
2008-04-10 10:22:51 +08:00
|
|
|
return child_iterator();
|
2008-04-08 12:40:51 +08:00
|
|
|
}
|
2008-08-22 23:38:55 +08:00
|
|
|
|
|
|
|
// CXXZeroInitValueExpr
|
|
|
|
Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
|
|
|
|
return child_iterator();
|
|
|
|
}
|
|
|
|
Stmt::child_iterator CXXZeroInitValueExpr::child_end() {
|
|
|
|
return child_iterator();
|
|
|
|
}
|
2008-09-10 07:47:53 +08:00
|
|
|
|
|
|
|
// CXXConditionDeclExpr
|
|
|
|
Stmt::child_iterator CXXConditionDeclExpr::child_begin() {
|
|
|
|
return getVarDecl();
|
|
|
|
}
|
|
|
|
Stmt::child_iterator CXXConditionDeclExpr::child_end() {
|
|
|
|
return child_iterator();
|
|
|
|
}
|
2008-10-28 03:41:14 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Named casts
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
/// getCastName - Get the name of the C++ cast being used, e.g.,
|
|
|
|
/// "static_cast", "dynamic_cast", "reinterpret_cast", or
|
|
|
|
/// "const_cast". The returned pointer must not be freed.
|
|
|
|
const char *CXXNamedCastExpr::getCastName() const {
|
|
|
|
switch (getStmtClass()) {
|
|
|
|
case CXXStaticCastExprClass: return "static_cast";
|
|
|
|
case CXXDynamicCastExprClass: return "dynamic_cast";
|
|
|
|
case CXXReinterpretCastExprClass: return "reinterpret_cast";
|
|
|
|
case CXXConstCastExprClass: return "const_cast";
|
|
|
|
default: return "<invalid cast>";
|
|
|
|
}
|
|
|
|
}
|