2006-10-25 04:09:21 +00:00
|
|
|
//===--- Stmt.cpp - Statement AST Node Implementation ---------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Chris Lattner and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the Stmt class and statement subclasses.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/AST/Stmt.h"
|
2006-12-04 18:06:35 +00:00
|
|
|
#include "clang/AST/ExprCXX.h"
|
2006-11-04 06:21:51 +00:00
|
|
|
#include "clang/AST/StmtVisitor.h"
|
2006-10-25 04:09:21 +00:00
|
|
|
using namespace llvm;
|
|
|
|
using namespace clang;
|
|
|
|
|
2006-11-04 20:54:18 +00:00
|
|
|
// Implement all the AST node visit methods using the StmtNodes.def database.
|
2007-02-27 02:53:10 +00:00
|
|
|
#define STMT(N, CLASS, PARENT) \
|
2006-11-04 07:16:04 +00:00
|
|
|
void CLASS::visit(StmtVisitor &V) { return V.Visit##CLASS(this); }
|
2006-10-25 04:29:46 +00:00
|
|
|
|
2007-02-27 02:53:10 +00:00
|
|
|
STMT(0, Stmt, )
|
2006-11-04 20:54:18 +00:00
|
|
|
#include "clang/AST/StmtNodes.def"
|
2007-03-23 22:27:02 +00:00
|
|
|
|
2007-04-02 22:35:25 +00:00
|
|
|
static const struct StmtClassNameTable {
|
2007-03-23 22:27:02 +00:00
|
|
|
int enumValue;
|
|
|
|
const char *className;
|
|
|
|
} sNames[] = {
|
|
|
|
#define STMT(N, CLASS, PARENT) { N, #CLASS },
|
|
|
|
#include "clang/AST/StmtNodes.def"
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *Stmt::getStmtClassName() const {
|
|
|
|
for (int i = 0; sNames[i].className; i++) {
|
|
|
|
if (sClass == sNames[i].enumValue)
|
|
|
|
return sNames[i].className;
|
|
|
|
}
|
|
|
|
return 0; // should never happen....
|
|
|
|
}
|
|
|
|
|