forked from OSchip/llvm-project
Don't require us to manually number the statements and expressions in StmtNodes.def. We don't need stable numbers yet, renumbering is a pain, and LAST_STMT had the wrong value anyway.
llvm-svn: 59300
This commit is contained in:
parent
d16b37efae
commit
be35ce953e
|
@ -92,11 +92,12 @@ namespace clang {
|
|||
class Stmt {
|
||||
public:
|
||||
enum StmtClass {
|
||||
#define STMT(N, CLASS, PARENT) CLASS##Class = N,
|
||||
#define FIRST_STMT(N) firstStmtConstant = N,
|
||||
#define LAST_STMT(N) lastStmtConstant = N,
|
||||
#define FIRST_EXPR(N) firstExprConstant = N,
|
||||
#define LAST_EXPR(N) lastExprConstant = N
|
||||
NoStmtClass = 0,
|
||||
#define STMT(CLASS, PARENT) CLASS##Class,
|
||||
#define FIRST_STMT(CLASS) firstStmtConstant = CLASS##Class,
|
||||
#define LAST_STMT(CLASS) lastStmtConstant = CLASS##Class,
|
||||
#define FIRST_EXPR(CLASS) firstExprConstant = CLASS##Class,
|
||||
#define LAST_EXPR(CLASS) lastExprConstant = CLASS##Class
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
};
|
||||
private:
|
||||
|
|
|
@ -12,115 +12,115 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef FIRST_STMT
|
||||
#define FIRST_STMT(n)
|
||||
#define LAST_STMT(n)
|
||||
#define FIRST_STMT(CLASS)
|
||||
#define LAST_STMT(CLASS)
|
||||
#endif
|
||||
|
||||
#ifndef FIRST_EXPR
|
||||
#define FIRST_EXPR(n)
|
||||
#define LAST_EXPR(n)
|
||||
#define FIRST_EXPR(CLASS)
|
||||
#define LAST_EXPR(CLASS)
|
||||
#endif
|
||||
|
||||
// Normal Statements.
|
||||
FIRST_STMT(1)
|
||||
STMT( 1, NullStmt , Stmt)
|
||||
STMT( 2, CompoundStmt , Stmt)
|
||||
STMT( 3, CaseStmt , SwitchCase)
|
||||
STMT( 4, DefaultStmt , SwitchCase)
|
||||
STMT( 5, LabelStmt , Stmt)
|
||||
STMT( 6, IfStmt , Stmt)
|
||||
STMT( 7, SwitchStmt , Stmt)
|
||||
STMT( 8, WhileStmt , Stmt)
|
||||
STMT( 9, DoStmt , Stmt)
|
||||
STMT(10, ForStmt , Stmt)
|
||||
STMT(11, GotoStmt , Stmt)
|
||||
STMT(12, IndirectGotoStmt, Stmt)
|
||||
STMT(13, ContinueStmt , Stmt)
|
||||
STMT(14, BreakStmt , Stmt)
|
||||
STMT(15, ReturnStmt , Stmt)
|
||||
STMT(16, DeclStmt , Stmt)
|
||||
STMT(17, SwitchCase , Stmt)
|
||||
STMT(NullStmt , Stmt)
|
||||
FIRST_STMT(NullStmt)
|
||||
STMT(CompoundStmt , Stmt)
|
||||
STMT(CaseStmt , SwitchCase)
|
||||
STMT(DefaultStmt , SwitchCase)
|
||||
STMT(LabelStmt , Stmt)
|
||||
STMT(IfStmt , Stmt)
|
||||
STMT(SwitchStmt , Stmt)
|
||||
STMT(WhileStmt , Stmt)
|
||||
STMT(DoStmt , Stmt)
|
||||
STMT(ForStmt , Stmt)
|
||||
STMT(GotoStmt , Stmt)
|
||||
STMT(IndirectGotoStmt, Stmt)
|
||||
STMT(ContinueStmt , Stmt)
|
||||
STMT(BreakStmt , Stmt)
|
||||
STMT(ReturnStmt , Stmt)
|
||||
STMT(DeclStmt , Stmt)
|
||||
STMT(SwitchCase , Stmt)
|
||||
|
||||
// GNU Stmt Extensions
|
||||
STMT(18, AsmStmt , Stmt)
|
||||
STMT(AsmStmt , Stmt)
|
||||
|
||||
// Obj-C statements
|
||||
STMT(19, ObjCAtTryStmt , Stmt)
|
||||
STMT(20, ObjCAtCatchStmt , Stmt)
|
||||
STMT(21, ObjCAtFinallyStmt , Stmt)
|
||||
STMT(22, ObjCAtThrowStmt , Stmt)
|
||||
STMT(23, ObjCAtSynchronizedStmt , Stmt)
|
||||
STMT(ObjCAtTryStmt , Stmt)
|
||||
STMT(ObjCAtCatchStmt , Stmt)
|
||||
STMT(ObjCAtFinallyStmt , Stmt)
|
||||
STMT(ObjCAtThrowStmt , Stmt)
|
||||
STMT(ObjCAtSynchronizedStmt , Stmt)
|
||||
// Obj-C2 statements
|
||||
STMT(24, ObjCForCollectionStmt, Stmt)
|
||||
STMT(ObjCForCollectionStmt, Stmt)
|
||||
|
||||
LAST_STMT(23)
|
||||
LAST_STMT(ObjCForCollectionStmt)
|
||||
|
||||
FIRST_EXPR(31)
|
||||
// Expressions.
|
||||
STMT(31, Expr , Stmt)
|
||||
STMT(32, PredefinedExpr , Expr)
|
||||
STMT(33, DeclRefExpr , Expr)
|
||||
STMT(34, IntegerLiteral , Expr)
|
||||
STMT(35, FloatingLiteral , Expr)
|
||||
STMT(36, ImaginaryLiteral , Expr)
|
||||
STMT(37, StringLiteral , Expr)
|
||||
STMT(38, CharacterLiteral , Expr)
|
||||
STMT(39, ParenExpr , Expr)
|
||||
STMT(40, UnaryOperator , Expr)
|
||||
STMT(41, SizeOfAlignOfExpr , Expr)
|
||||
STMT(42, ArraySubscriptExpr , Expr)
|
||||
STMT(43, CallExpr , Expr)
|
||||
STMT(44, MemberExpr , Expr)
|
||||
STMT(45, CastExpr , Expr)
|
||||
STMT(46, BinaryOperator , Expr)
|
||||
STMT(47, CompoundAssignOperator, BinaryOperator)
|
||||
STMT(48, ConditionalOperator , Expr)
|
||||
STMT(49, ImplicitCastExpr , CastExpr)
|
||||
STMT(50, ExplicitCastExpr , CastExpr)
|
||||
STMT(51, CStyleCastExpr , ExplicitCastExpr)
|
||||
STMT(52, CompoundLiteralExpr , Expr)
|
||||
STMT(53, ExtVectorElementExpr , Expr)
|
||||
STMT(54, InitListExpr , Expr)
|
||||
STMT(55, VAArgExpr , Expr)
|
||||
STMT(Expr , Stmt)
|
||||
FIRST_EXPR(Expr)
|
||||
STMT(PredefinedExpr , Expr)
|
||||
STMT(DeclRefExpr , Expr)
|
||||
STMT(IntegerLiteral , Expr)
|
||||
STMT(FloatingLiteral , Expr)
|
||||
STMT(ImaginaryLiteral , Expr)
|
||||
STMT(StringLiteral , Expr)
|
||||
STMT(CharacterLiteral , Expr)
|
||||
STMT(ParenExpr , Expr)
|
||||
STMT(UnaryOperator , Expr)
|
||||
STMT(SizeOfAlignOfExpr , Expr)
|
||||
STMT(ArraySubscriptExpr , Expr)
|
||||
STMT(CallExpr , Expr)
|
||||
STMT(MemberExpr , Expr)
|
||||
STMT(CastExpr , Expr)
|
||||
STMT(BinaryOperator , Expr)
|
||||
STMT(CompoundAssignOperator, BinaryOperator)
|
||||
STMT(ConditionalOperator , Expr)
|
||||
STMT(ImplicitCastExpr , CastExpr)
|
||||
STMT(ExplicitCastExpr , CastExpr)
|
||||
STMT(CStyleCastExpr , ExplicitCastExpr)
|
||||
STMT(CompoundLiteralExpr , Expr)
|
||||
STMT(ExtVectorElementExpr , Expr)
|
||||
STMT(InitListExpr , Expr)
|
||||
STMT(VAArgExpr , Expr)
|
||||
|
||||
// GNU Extensions.
|
||||
STMT(56, AddrLabelExpr , Expr)
|
||||
STMT(57, StmtExpr , Expr)
|
||||
STMT(58, TypesCompatibleExpr , Expr)
|
||||
STMT(59, ChooseExpr , Expr)
|
||||
STMT(AddrLabelExpr , Expr)
|
||||
STMT(StmtExpr , Expr)
|
||||
STMT(TypesCompatibleExpr , Expr)
|
||||
STMT(ChooseExpr , Expr)
|
||||
|
||||
// C++ Expressions.
|
||||
STMT(60, CXXNamedCastExpr , ExplicitCastExpr)
|
||||
STMT(61, CXXStaticCastExpr , CXXNamedCastExpr)
|
||||
STMT(62, CXXDynamicCastExpr , CXXNamedCastExpr)
|
||||
STMT(63, CXXReinterpretCastExpr , CXXNamedCastExpr)
|
||||
STMT(64, CXXConstCastExpr , CXXNamedCastExpr)
|
||||
STMT(65, CXXFunctionalCastExpr , Expr)
|
||||
STMT(66, CXXTypeidExpr , Expr)
|
||||
STMT(67, CXXBoolLiteralExpr , Expr)
|
||||
STMT(68, CXXThisExpr , Expr)
|
||||
STMT(69, CXXThrowExpr , Expr)
|
||||
STMT(70, CXXDefaultArgExpr , Expr)
|
||||
STMT(71, CXXZeroInitValueExpr , Expr)
|
||||
STMT(72, CXXConditionDeclExpr , DeclRefExpr)
|
||||
STMT(CXXNamedCastExpr , ExplicitCastExpr)
|
||||
STMT(CXXStaticCastExpr , CXXNamedCastExpr)
|
||||
STMT(CXXDynamicCastExpr , CXXNamedCastExpr)
|
||||
STMT(CXXReinterpretCastExpr , CXXNamedCastExpr)
|
||||
STMT(CXXConstCastExpr , CXXNamedCastExpr)
|
||||
STMT(CXXFunctionalCastExpr , Expr)
|
||||
STMT(CXXTypeidExpr , Expr)
|
||||
STMT(CXXBoolLiteralExpr , Expr)
|
||||
STMT(CXXThisExpr , Expr)
|
||||
STMT(CXXThrowExpr , Expr)
|
||||
STMT(CXXDefaultArgExpr , Expr)
|
||||
STMT(CXXZeroInitValueExpr , Expr)
|
||||
STMT(CXXConditionDeclExpr , DeclRefExpr)
|
||||
|
||||
// Obj-C Expressions.
|
||||
STMT(80, ObjCStringLiteral , Expr)
|
||||
STMT(81, ObjCEncodeExpr , Expr)
|
||||
STMT(82, ObjCMessageExpr , Expr)
|
||||
STMT(83, ObjCSelectorExpr , Expr)
|
||||
STMT(84, ObjCProtocolExpr , Expr)
|
||||
STMT(85, ObjCIvarRefExpr , Expr)
|
||||
STMT(86, ObjCPropertyRefExpr , Expr)
|
||||
STMT(87, ObjCSuperExpr , Expr)
|
||||
STMT(ObjCStringLiteral , Expr)
|
||||
STMT(ObjCEncodeExpr , Expr)
|
||||
STMT(ObjCMessageExpr , Expr)
|
||||
STMT(ObjCSelectorExpr , Expr)
|
||||
STMT(ObjCProtocolExpr , Expr)
|
||||
STMT(ObjCIvarRefExpr , Expr)
|
||||
STMT(ObjCPropertyRefExpr , Expr)
|
||||
STMT(ObjCSuperExpr , Expr)
|
||||
|
||||
// Clang Extensions.
|
||||
STMT(90, OverloadExpr , Expr)
|
||||
STMT(91, ShuffleVectorExpr , Expr)
|
||||
STMT(92, BlockExpr , Expr)
|
||||
STMT(93, BlockDeclRefExpr , Expr)
|
||||
STMT(OverloadExpr , Expr)
|
||||
STMT(ShuffleVectorExpr , Expr)
|
||||
STMT(BlockExpr , Expr)
|
||||
STMT(BlockDeclRefExpr , Expr)
|
||||
|
||||
LAST_EXPR(93)
|
||||
LAST_EXPR(BlockDeclRefExpr)
|
||||
|
||||
#undef STMT
|
||||
#undef FIRST_STMT
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
// Top switch stmt: dispatch to VisitFooStmt for each FooStmt.
|
||||
switch (S->getStmtClass()) {
|
||||
default: assert(0 && "Unknown stmt kind!");
|
||||
#define STMT(N, CLASS, PARENT) \
|
||||
#define STMT(CLASS, PARENT) \
|
||||
case Stmt::CLASS ## Class: DISPATCH(CLASS, CLASS);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
|
||||
// If the implementation chooses not to implement a certain visit method, fall
|
||||
// back on VisitExpr or whatever else is the superclass.
|
||||
#define STMT(N, CLASS, PARENT) \
|
||||
#define STMT(CLASS, PARENT) \
|
||||
RetTy Visit ## CLASS(CLASS *S) { DISPATCH(PARENT, PARENT); }
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
|
|||
|
||||
// Intialize the table on the first use.
|
||||
Initialized = true;
|
||||
#define STMT(N, CLASS, PARENT) \
|
||||
StmtClassInfo[N].Name = #CLASS; \
|
||||
StmtClassInfo[N].Size = sizeof(CLASS);
|
||||
#define STMT(CLASS, PARENT) \
|
||||
StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
|
||||
StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
|
||||
return StmtClassInfo[E];
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace {
|
|||
}
|
||||
|
||||
void VisitStmt(Stmt *Node);
|
||||
#define STMT(N, CLASS, PARENT) \
|
||||
#define STMT(CLASS, PARENT) \
|
||||
void Visit##CLASS(CLASS *Node);
|
||||
#include "clang/AST/StmtNodes.def"
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue