Id's for Stmt-inherited classes

This commit is contained in:
Anton Mitrokhin
2015-07-09 14:45:33 +03:00
parent 26a93bc733
commit 8217448ee5
6 changed files with 82 additions and 36 deletions

50
ast.h
View File

@@ -79,8 +79,51 @@ public:
/** An enumeration for keeping track of the concrete subclass of Value
that is actually instantiated.*/
enum ASTNodeTy {
ExprID,
StmtID
/* For classes inherited from Expr */
AddressOfExprID,
AssignExprID,
BinaryExprID,
ConstExprID,
DerefExprID,
PtrDerefExprID,
RefDerefExprID,
ExprListID,
FunctionCallExprID,
FunctionSymbolExprID,
IndexExprID,
StructMemberExprID,
VectorMemberExprID,
NewExprID,
NullPointerExprID,
ReferenceExprID,
SelectExprID,
SizeOfExprID,
SymbolExprID,
SyncExprID,
TypeCastExprID,
UnaryExprID,
/* For classes inherited from Stmt */
AssertStmtID,
BreakStmtID,
CaseStmtID,
ContinueStmtID,
DeclStmtID,
DefaultStmtID,
DeleteStmtID,
DoStmtID,
ExprStmtID,
ForeachActiveStmtID,
ForeachStmtID,
ForeachUniqueStmtID,
ForStmtID,
GotoStmtID,
IfStmtID,
LabeledStmtID,
PrintStmtID,
ReturnStmtID,
StmtListID,
SwitchStmtID,
UnmaskedStmtID
};
/** Return an ID for the concrete type of this object. This is used to
@@ -93,6 +136,9 @@ public:
static inline bool classof(ASTNode const*) { return true; }
};
class AST {
public:
/** Add the AST for a function described by the given declaration