summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-27 18:40:21 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-27 18:40:21 +0000
commit5778acf5e8f0bf15f0be5827309df9505915e425 (patch)
tree4ebbf75ca5013dbe4b2ed46bddc6c6ed8737e819 /clang/lib/AST/Stmt.cpp
parentb5cf101fa2cd86f3cafd964c26480e1efa79b9ab (diff)
downloadbcm5719-llvm-5778acf5e8f0bf15f0be5827309df9505915e425.tar.gz
bcm5719-llvm-5778acf5e8f0bf15f0be5827309df9505915e425.zip
- Move ExprIterator to Stmt.h so that it can be used by classes defined in Stmt.h
- Implement child_begin() and child_end() for AsmStmt. Previously these had stub implementations that did not iterate over the input/output operands of an inline assembly statement. - Use ExprIterator for performing iteration over input/output operands. llvm-svn: 58261
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r--clang/lib/AST/Stmt.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index f30e105b179..9c06807b3b9 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -128,6 +128,19 @@ bool Stmt::hasImplicitControlFlow() const {
}
}
+const Expr* AsmStmt::getOutputExpr(unsigned i) const {
+ return cast<Expr>(Exprs[i]);
+}
+Expr* AsmStmt::getOutputExpr(unsigned i) {
+ return cast<Expr>(Exprs[i]);
+}
+Expr* AsmStmt::getInputExpr(unsigned i) {
+ return cast<Expr>(Exprs[i + NumOutputs]);
+}
+const Expr* AsmStmt::getInputExpr(unsigned i) const {
+ return cast<Expr>(Exprs[i + NumOutputs]);
+}
+
//===----------------------------------------------------------------------===//
// Constructors
//===----------------------------------------------------------------------===//
@@ -279,8 +292,12 @@ Stmt::child_iterator ReturnStmt::child_end() {
}
// AsmStmt
-Stmt::child_iterator AsmStmt::child_begin() { return child_iterator(); }
-Stmt::child_iterator AsmStmt::child_end() { return child_iterator(); }
+Stmt::child_iterator AsmStmt::child_begin() {
+ return Exprs.empty() ? 0 : &Exprs[0];
+}
+Stmt::child_iterator AsmStmt::child_end() {
+ return Exprs.empty() ? 0 : &Exprs[0] + Exprs.size();
+}
// ObjCAtCatchStmt
Stmt::child_iterator ObjCAtCatchStmt::child_begin() { return &SubExprs[0]; }
OpenPOWER on IntegriCloud