Stmt::child_iterator ObjCAtThrowStmt::child_end() {
return &Throw+1;
}
+
+// ObjCAtSynchronizedStmt
+Stmt::child_iterator ObjCAtSynchronizedStmt::child_begin() {
+ return &SynchBody;
+}
+
+Stmt::child_iterator ObjCAtSynchronizedStmt::child_end() {
+ return &SynchBody+1;
+}
+
Stmt* Throw = D.ReadOwnedPtr<Stmt>();
return new ObjCAtThrowStmt(L,Throw);
}
+
+void ObjCAtSynchronizedStmt::EmitImpl(Serializer& S) const {
+ S.Emit(AtSynchronizedLoc);
+ S.EmitOwnedPtr(SynchExpr);
+ S.EmitOwnedPtr(SynchBody);
+}
+
+ObjCAtSynchronizedStmt* ObjCAtSynchronizedStmt::CreateImpl(Deserializer& D) {
+ SourceLocation L = SourceLocation::ReadVal(D);
+ Expr *syncExpr = D.ReadOwnedPtr<Expr>();
+ Stmt *synchBody = D.ReadOwnedPtr<Stmt>();
+ ObjCAtSynchronizedStmt* stmt = new ObjCAtSynchronizedStmt(L,syncExpr,synchBody);
+ return stmt;
+}
void ObjCAtTryStmt::EmitImpl(Serializer& S) const {
S.Emit(AtTryLoc);
/// @synchronized '(' expression ')'
///
Parser::StmtResult Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
- return 0;
+ ExprResult Res;
+ ConsumeToken(); // consume synchronized
+ if (Tok.isNot(tok::l_paren)) {
+ Diag (Tok, diag::err_expected_lparen_after, "@synchronized");
+ return true;
+ }
+ ConsumeParen(); // '('
+ Res = ParseExpression();
+ if (Res.isInvalid) {
+ SkipUntil(tok::semi);
+ return true;
+ }
+ if (Tok.isNot(tok::r_paren)) {
+ Diag (Tok, diag::err_expected_rparen);
+ return true;
+ }
+ ConsumeParen(); // ')'
+ StmtResult SynchBody = ParseCompoundStatementBody();
+ if (SynchBody.isInvalid)
+ SynchBody = Actions.ActOnNullStmt(Tok.getLocation());
+ return Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.Val, SynchBody.Val);
}
/// objc-try-catch-statement:
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
StmtTy *Throw);
+ virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
+ ExprTy *SynchExpr,
+ StmtTy *SynchBody);
//===--------------------------------------------------------------------===//
// Expression Parsing Callbacks: SemaExpr.cpp.
return TS;
}
+Action::StmtResult
+Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, ExprTy *SynchExpr,
+ StmtTy *SynchBody) {
+ ObjCAtSynchronizedStmt *SS = new ObjCAtSynchronizedStmt(AtLoc,
+ static_cast<Expr*>(SynchExpr), static_cast<Stmt*>(SynchBody));
+ return SS;
+}
}
static bool classof(const ObjCAtSynchronizedStmt *) { return true; }
+ virtual child_iterator child_begin();
+ virtual child_iterator child_end();
+
virtual void EmitImpl(llvm::Serializer& S) const;
static ObjCAtSynchronizedStmt* CreateImpl(llvm::Deserializer& D);
};
return 0;
}
+ virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
+ ExprTy *SynchExpr,
+ StmtTy *SynchBody) {
+ return 0;
+ }
+
//===--------------------------------------------------------------------===//
// Expression Parsing Callbacks.
//===--------------------------------------------------------------------===//