[cfe-commits] r41329 - /cfe/trunk/include/clang/AST/Stmt.h
Ted Kremenek
kremenek at apple.com
Thu Aug 23 11:04:38 PDT 2007
Author: kremenek
Date: Thu Aug 23 13:04:38 2007
New Revision: 41329
URL: http://llvm.org/viewvc/llvm-project?rev=41329&view=rev
Log:
Refactored "getSubStmt" and "SubStmt" from the CaseStmt and DefaultStmt
class to their common parent class SwitchCase.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=41329&r1=41328&r2=41329&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu Aug 23 13:04:38 2007
@@ -145,8 +145,10 @@
// A pointer to the following CaseStmt or DefaultStmt class,
// used by SwitchStmt.
SwitchCase *NextSwitchCase;
+ Stmt *SubStmt;
protected:
- SwitchCase(StmtClass SC) : Stmt(SC), NextSwitchCase(0) {}
+ SwitchCase(StmtClass SC, Stmt* substmt) : Stmt(SC), NextSwitchCase(0),
+ SubStmt(substmt) {}
public:
const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
@@ -155,6 +157,8 @@
void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; }
+ Stmt *getSubStmt() { return SubStmt; }
+
static bool classof(const Stmt *T) {
return T->getStmtClass() == CaseStmtClass ||
T->getStmtClass() == DefaultStmtClass;
@@ -165,14 +169,12 @@
class CaseStmt : public SwitchCase {
Expr *LHSVal;
Expr *RHSVal; // Non-null for GNU "case 1 ... 4" extension
- Stmt *SubStmt;
public:
CaseStmt(Expr *lhs, Expr *rhs, Stmt *substmt)
- : SwitchCase(CaseStmtClass), LHSVal(lhs), RHSVal(rhs), SubStmt(substmt) {}
+ : SwitchCase(CaseStmtClass,substmt), LHSVal(lhs), RHSVal(rhs) {}
Expr *getLHS() { return LHSVal; }
Expr *getRHS() { return RHSVal; }
- Stmt *getSubStmt() { return SubStmt; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CaseStmtClass;
@@ -182,13 +184,11 @@
class DefaultStmt : public SwitchCase {
SourceLocation DefaultLoc;
- Stmt *SubStmt;
public:
- DefaultStmt(SourceLocation DL, Stmt *substmt) : SwitchCase(DefaultStmtClass),
- DefaultLoc(DL), SubStmt(substmt) {}
+ DefaultStmt(SourceLocation DL, Stmt *substmt) :
+ SwitchCase(DefaultStmtClass,substmt), DefaultLoc(DL) {}
SourceLocation getDefaultLoc() const { return DefaultLoc; }
- Stmt *getSubStmt() { return SubStmt; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == DefaultStmtClass;
More information about the cfe-commits
mailing list