forked from OSchip/llvm-project
parent
ade0abb498
commit
48085b86ae
|
@ -249,3 +249,13 @@ Stmt::child_iterator ObjCAtThrowStmt::child_begin() {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -893,6 +893,20 @@ ObjCAtThrowStmt* ObjCAtThrowStmt::CreateImpl(Deserializer& D) {
|
|||
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);
|
||||
|
|
|
@ -1113,7 +1113,27 @@ Parser::StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
|
|||
/// @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:
|
||||
|
|
|
@ -378,6 +378,9 @@ public:
|
|||
|
||||
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
|
||||
StmtTy *Throw);
|
||||
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
|
||||
ExprTy *SynchExpr,
|
||||
StmtTy *SynchBody);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Expression Parsing Callbacks: SemaExpr.cpp.
|
||||
|
|
|
@ -809,5 +809,12 @@ Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) {
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -992,6 +992,9 @@ public:
|
|||
}
|
||||
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);
|
||||
};
|
||||
|
|
|
@ -335,6 +335,12 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
|
||||
ExprTy *SynchExpr,
|
||||
StmtTy *SynchBody) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Expression Parsing Callbacks.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue