[cfe-commits] r39110 - in /cfe/cfe/trunk/include/clang/AST: Expr.h Stmt.h StmtVisitor.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:27:36 PDT 2007
Author: sabre
Date: Wed Jul 11 11:27:36 2007
New Revision: 39110
URL: http://llvm.org/viewvc/llvm-project?rev=39110&view=rev
Log:
add accessors to ast nodes, remove VisitNull method from the visitor which is dead
Modified:
cfe/cfe/trunk/include/clang/AST/Expr.h
cfe/cfe/trunk/include/clang/AST/Stmt.h
cfe/cfe/trunk/include/clang/AST/StmtVisitor.h
Modified: cfe/cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Expr.h?rev=39110&r1=39109&r2=39110&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Expr.h Wed Jul 11 11:27:36 2007
@@ -64,10 +64,15 @@
class StringExpr : public Expr {
const char *StrData;
unsigned ByteLength;
- bool isWide;
+ bool IsWide;
public:
StringExpr(const char *strData, unsigned byteLength, bool Wide);
virtual ~StringExpr();
+
+ const char *getStrData() const { return StrData; }
+ unsigned getByteLength() const { return ByteLength; }
+ bool isWide() const { return IsWide; }
+
virtual void visit(StmtVisitor &Visitor);
};
@@ -79,6 +84,9 @@
public:
ParenExpr(SourceLocation l, SourceLocation r, Expr *val)
: L(l), R(r), Val(val) {}
+
+ Expr *getSubExpr() { return Val; }
+
virtual void visit(StmtVisitor &Visitor);
};
@@ -101,16 +109,19 @@
};
UnaryOperator(Expr *input, Opcode opc)
- : Input(input), Opc(opc) {}
+ : Val(input), Opc(opc) {}
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
/// corresponds to, e.g. "sizeof" or "[pre]++"
static const char *getOpcodeStr(Opcode Op);
-
+
+ Opcode getOpcode() const { return Opc; }
+ Expr *getSubExpr() { return Val; }
+
virtual void visit(StmtVisitor &Visitor);
private:
- Expr *Input;
+ Expr *Val;
Opcode Opc;
};
@@ -122,6 +133,8 @@
public:
SizeOfAlignOfTypeExpr(bool issizeof, Type *ty) : isSizeof(issizeof), Ty(ty) {
}
+
+ bool isSizeOf() const { return isSizeof; }
virtual void visit(StmtVisitor &Visitor);
};
@@ -136,6 +149,9 @@
public:
ArraySubscriptExpr(Expr *base, Expr *idx) : Base(base), Idx(idx) {}
+ Expr *getBase() { return Base; }
+ Expr *getIdx() { return Idx; }
+
virtual void visit(StmtVisitor &Visitor);
};
@@ -152,6 +168,8 @@
delete [] Args;
}
+ Expr *getCallee() { return Fn; }
+
/// getNumArgs - Return the number of actual arguments to this call.
///
unsigned getNumArgs() const { return NumArgs; }
@@ -174,11 +192,16 @@
class MemberExpr : public Expr {
Expr *Base;
Decl *MemberDecl;
- bool isArrow; // True if this is "X->F", false if this is "X.F".
+ bool IsArrow; // True if this is "X->F", false if this is "X.F".
public:
MemberExpr(Expr *base, bool isarrow, Decl *memberdecl)
- : Base(base), MemberDecl(memberdecl), isArrow(isarrow) {
+ : Base(base), MemberDecl(memberdecl), IsArrow(isarrow) {
}
+
+ Expr *getBase() { return Base; }
+ Decl *getMemberDecl() { return MemberDecl; }
+ bool isArrow() const { return IsArrow; }
+
virtual void visit(StmtVisitor &Visitor);
};
@@ -190,6 +213,7 @@
public:
CastExpr(Type *ty, Expr *op) : Ty(ty), Op(op) {}
+ Expr *getSubExpr() { return Op; }
virtual void visit(StmtVisitor &Visitor);
};
@@ -224,6 +248,10 @@
/// corresponds to, e.g. "<<=".
static const char *getOpcodeStr(Opcode Op);
+ Opcode getOpcode() const { return Opc; }
+ Expr *getLHS() { return LHS; }
+ Expr *getRHS() { return RHS; }
+
virtual void visit(StmtVisitor &Visitor);
private:
@@ -239,6 +267,12 @@
public:
ConditionalOperator(Expr *cond, Expr *lhs, Expr *rhs)
: Cond(cond), LHS(lhs), RHS(rhs) {}
+
+ Expr *getCond() { return Cond; }
+ Expr *getLHS() { return LHS; }
+ Expr *getRHS() { return RHS; }
+
+
virtual void visit(StmtVisitor &Visitor);
};
Modified: cfe/cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Stmt.h?rev=39110&r1=39109&r2=39110&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Stmt.h Wed Jul 11 11:27:36 2007
@@ -81,6 +81,8 @@
public:
ReturnStmt(Expr *E = 0) : RetExpr(E) {}
+ Expr *getRetValue() { return RetExpr; }
+
virtual void visit(StmtVisitor &Visitor);
};
Modified: cfe/cfe/trunk/include/clang/AST/StmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/StmtVisitor.h?rev=39110&r1=39109&r2=39110&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/StmtVisitor.h (original)
+++ cfe/cfe/trunk/include/clang/AST/StmtVisitor.h Wed Jul 11 11:27:36 2007
@@ -42,10 +42,6 @@
public:
virtual ~StmtVisitor();
- /// VisitNull - Visit a null pointer.
- ///
- virtual void VisitNull() {}
-
virtual void VisitStmt(Stmt *Node) {}
virtual void VisitExpr(Expr *Node);
More information about the cfe-commits
mailing list