blob: 08d355dec4fabb743c1b8a456fbb3e397bf1123d [file] [log] [blame]
Chris Lattnerf42cce72006-10-25 04:09:21 +00001//===--- Stmt.cpp - Statement AST Node Implementation ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Stmt class and statement subclasses.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/Stmt.h"
Chris Lattner29375652006-12-04 18:06:35 +000015#include "clang/AST/ExprCXX.h"
Chris Lattner5e9a8782006-11-04 06:21:51 +000016#include "clang/AST/StmtVisitor.h"
Chris Lattnerf42cce72006-10-25 04:09:21 +000017using namespace llvm;
18using namespace clang;
19
Chris Lattner76af8442006-11-04 20:54:18 +000020// Implement all the AST node visit methods using the StmtNodes.def database.
Steve Naroff7f890eb2007-02-27 02:53:10 +000021#define STMT(N, CLASS, PARENT) \
Chris Lattner9ea960a2006-11-04 07:16:04 +000022void CLASS::visit(StmtVisitor &V) { return V.Visit##CLASS(this); }
Chris Lattnere5cca062006-10-25 04:29:46 +000023
Steve Naroff7f890eb2007-02-27 02:53:10 +000024STMT(0, Stmt, )
Chris Lattner76af8442006-11-04 20:54:18 +000025#include "clang/AST/StmtNodes.def"
Steve Narofff1e53692007-03-23 22:27:02 +000026
27static struct StmtClassNameTable {
28 int enumValue;
29 const char *className;
30} sNames[] = {
31#define STMT(N, CLASS, PARENT) { N, #CLASS },
32#include "clang/AST/StmtNodes.def"
33 { 0, 0 }
34};
35
36const char *Stmt::getStmtClassName() const {
37 for (int i = 0; sNames[i].className; i++) {
38 if (sClass == sNames[i].enumValue)
39 return sNames[i].className;
40 }
41 return 0; // should never happen....
42}
43