add a NullStmt ast node.

llvm-svn: 39505
This commit is contained in:
Chris Lattner 2007-05-28 01:41:58 +00:00
parent bed314465a
commit 012a6cf1de
3 changed files with 36 additions and 15 deletions

View File

@ -105,6 +105,10 @@ void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
Indent() << "}";
}
void StmtPrinter::VisitNullStmt(NullStmt *Node) {
Indent() << ";\n";
}
void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {
Indent();
PrintRawCompoundStmt(Node);

View File

@ -62,6 +62,22 @@ public:
static bool classof(const Stmt *) { return true; }
};
/// NullStmt - This is the null statement ";": C99 6.8.3p3.
///
class NullStmt : public Stmt {
SourceLocation SemiLoc;
public:
NullStmt(SourceLocation L) : Stmt(NullStmtClass), SemiLoc(L) {}
SourceLocation getSemiLoc() const { return SemiLoc; }
virtual void visit(StmtVisitor &Visitor);
static bool classof(const Stmt *T) {
return T->getStmtClass() == NullStmtClass;
}
static bool classof(const NullStmt *) { return true; }
};
/// CompoundStmt - This represents a group of statements like { stmt stmt }.
///
class CompoundStmt : public Stmt {

View File

@ -23,21 +23,22 @@
// Normal Statements.
FIRST_STMT(1)
STMT(1, CompoundStmt , Stmt)
STMT(2, CaseStmt , Stmt)
STMT(3, DefaultStmt , Stmt)
STMT(4, LabelStmt , Stmt)
STMT(5, IfStmt , Stmt)
STMT(6, SwitchStmt , Stmt)
STMT(7, WhileStmt , Stmt)
STMT(8, DoStmt , Stmt)
STMT(9, ForStmt , Stmt)
STMT(10, GotoStmt , Stmt)
STMT(11, IndirectGotoStmt, Stmt)
STMT(12, ContinueStmt , Stmt)
STMT(13, BreakStmt , Stmt)
STMT(14, ReturnStmt , Stmt)
LAST_STMT(14)
STMT( 1, NullStmt , Stmt)
STMT( 2, CompoundStmt , Stmt)
STMT( 3, CaseStmt , Stmt)
STMT( 4, DefaultStmt , Stmt)
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)
LAST_STMT(15)
FIRST_EXPR(32)
// Expressions.