aboutsummaryrefslogtreecommitdiff
path: root/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
commitce2fc3a343ea6098a96d587071cee7299f11957a (patch)
tree563bb7d1a669f989a7f984d8e21cb482a825f2cd /lib/AST/Stmt.cpp
parent54055232a5ddb9529726e934301b125cb720a273 (diff)
- 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r--lib/AST/Stmt.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index f30e105b17..9c06807b3b 100644
--- a/lib/AST/Stmt.cpp
+++ b/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]; }