else return child_iterator();
}
+// AsmStmt
+Stmt::child_iterator AsmStmt::child_begin() { return child_iterator(); }
+Stmt::child_iterator AsmStmt::child_end() { return child_iterator(); }
+
OS << ";\n";
}
+
+void StmtPrinter::VisitAsmStmt(AsmStmt *Node) {
+ Indent() << "asm (/*todo*/);\n";
+}
+
//===----------------------------------------------------------------------===//
// Expr printing methods.
//===----------------------------------------------------------------------===//
///
Parser::StmtResult Parser::ParseAsmStatement() {
assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
- ConsumeToken();
+ SourceLocation AsmLoc = ConsumeToken();
DeclSpec DS;
SourceLocation Loc = Tok.getLocation();
}
}
- MatchRHSPunctuation(tok::r_paren, Loc);
+ SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, Loc);
- // FIXME: Implement action for asm parsing.
- return false;
+ // FIXME: Pass all the details down to the action.
+ return Actions.ActOnAsmStmt(AsmLoc, RParenLoc);
}
/// ParseAsmOperands - Parse the asm-operands production as used by
virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
ExprTy *RetValExp);
+ virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
+ SourceLocation RParenLoc);
+
//===--------------------------------------------------------------------===//
// Expression Parsing Callbacks: SemaExpr.cpp.
return new ReturnStmt(ReturnLoc, (Expr*)RetValExp);
}
+Sema::StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
+ SourceLocation RParenLoc) {
+ return new AsmStmt(AsmLoc, RParenLoc);
+}
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
virtual child_iterator child_end();
};
+/// AsmStmt - This represents a GNU inline-assembly statement extension.
+///
+class AsmStmt : public Stmt {
+ SourceLocation AsmLoc, RParenLoc;
+ // FIXME: This doesn't capture most of the interesting pieces.
+public:
+ AsmStmt(SourceLocation asmloc, SourceLocation rparenloc)
+ : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc) {}
+
+ virtual SourceRange getSourceRange() const {
+ return SourceRange(AsmLoc, RParenLoc);
+ }
+
+ static bool classof(const Stmt *T) {return T->getStmtClass() == AsmStmtClass;}
+ static bool classof(const AsmStmt *) { return true; }
+
+ virtual child_iterator child_begin();
+ virtual child_iterator child_end();
+};
+
+
} // end namespace clang
//===----------------------------------------------------------------------===//
STMT(15, ReturnStmt , Stmt)
STMT(16, DeclStmt , Stmt)
STMT(17, SwitchCase , Stmt)
+
+// GNU Stmt Extensions
+STMT(18, AsmStmt , Stmt)
LAST_STMT(17)
FIRST_EXPR(31)
ExprTy *RetValExp) {
return 0;
}
+ virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
+ SourceLocation RParenLoc) {
+ return 0;
+ }
//===--------------------------------------------------------------------===//
// Expression Parsing Callbacks.