зеркало из https://github.com/microsoft/clang-1.git
Bunch of type defs, etc. for @synchronized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46520 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
356916ec84
Коммит
c385c90c68
|
@ -455,6 +455,17 @@ void StmtPrinter::VisitObjCAtThrowStmt (ObjCAtThrowStmt *Node) {
|
|||
OS << ";\n";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitObjCAtSynchronizedStmt (ObjCAtSynchronizedStmt *Node) {
|
||||
Indent() << "@synchronized (";
|
||||
PrintExpr(Node->getSynchExpr());
|
||||
OS << ")";
|
||||
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getSynchBody()))
|
||||
{
|
||||
PrintRawCompoundStmt(CS);
|
||||
OS << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Expr printing methods.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -1109,6 +1109,13 @@ Parser::StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
|
|||
return Actions.ActOnObjCAtThrowStmt(atLoc, Res.Val);
|
||||
}
|
||||
|
||||
/// objc-synchronized-statement:
|
||||
/// @synchronized '(' expression ')'
|
||||
///
|
||||
Parser::StmtResult Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// objc-try-catch-statement:
|
||||
/// @try compound-statement objc-catch-list[opt]
|
||||
/// @try compound-statement objc-catch-list[opt] @finally compound-statement
|
||||
|
|
|
@ -36,7 +36,7 @@ using namespace clang;
|
|||
/// jump-statement
|
||||
/// [OBC] objc-throw-statement
|
||||
/// [OBC] objc-try-catch-statement
|
||||
/// [OBC] objc-synchronized-statement [TODO]
|
||||
/// [OBC] objc-synchronized-statement
|
||||
/// [GNU] asm-statement
|
||||
/// [OMP] openmp-construct [TODO]
|
||||
///
|
||||
|
@ -91,6 +91,8 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
|
|||
return ParseObjCTryStmt(AtLoc);
|
||||
else if (Tok.isObjCAtKeyword(tok::objc_throw))
|
||||
return ParseObjCThrowStmt(AtLoc);
|
||||
else if (Tok.isObjCAtKeyword(tok::objc_synchronized))
|
||||
return ParseObjCSynchronizedStmt(AtLoc);
|
||||
ExprResult Res = ParseExpressionWithLeadingAt(AtLoc);
|
||||
if (Res.isInvalid) {
|
||||
// If the expression is invalid, skip ahead to the next semicolon. Not
|
||||
|
|
|
@ -962,6 +962,40 @@ public:
|
|||
static ObjCAtTryStmt* CreateImpl(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
/// ObjCAtSynchronizedStmt - This is for objective-c's @synchronized statement.
|
||||
///
|
||||
class ObjCAtSynchronizedStmt : public Stmt {
|
||||
private:
|
||||
Expr* SynchExpr;
|
||||
Stmt* SynchBody;
|
||||
SourceLocation AtSynchronizedLoc;
|
||||
|
||||
public:
|
||||
ObjCAtSynchronizedStmt(SourceLocation atSynchronizedLoc, Expr *synchExpr,
|
||||
Stmt *synchBody)
|
||||
: Stmt(ObjCAtSynchronizedStmtClass),
|
||||
SynchExpr(synchExpr), SynchBody(synchBody),
|
||||
AtSynchronizedLoc(atSynchronizedLoc) {}
|
||||
|
||||
const Stmt *getSynchBody() const { return SynchBody; }
|
||||
Stmt *getSynchBody() { return SynchBody; }
|
||||
|
||||
const Expr *getSynchExpr() const { return SynchExpr; }
|
||||
Expr *getSynchExpr() { return SynchExpr; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtSynchronizedLoc, SynchBody->getLocEnd());
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtSynchronizedStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtSynchronizedStmt *) { return true; }
|
||||
|
||||
virtual void EmitImpl(llvm::Serializer& S) const;
|
||||
static ObjCAtSynchronizedStmt* CreateImpl(llvm::Deserializer& D);
|
||||
};
|
||||
|
||||
/// ObjCAtThrowStmt - This represents objective-c's @throw statement.
|
||||
class ObjCAtThrowStmt : public Stmt {
|
||||
Stmt *Throw;
|
||||
|
|
|
@ -49,8 +49,9 @@ STMT(19, ObjCAtTryStmt , Stmt)
|
|||
STMT(20, ObjCAtCatchStmt , Stmt)
|
||||
STMT(21, ObjCAtFinallyStmt , Stmt)
|
||||
STMT(22, ObjCAtThrowStmt , Stmt)
|
||||
STMT(23, ObjCAtSynchronizedStmt , Stmt)
|
||||
// Obj-C2 statements
|
||||
STMT(23, ObjCForCollectionStmt, Stmt)
|
||||
STMT(24, ObjCForCollectionStmt, Stmt)
|
||||
|
||||
LAST_STMT(23)
|
||||
|
||||
|
|
|
@ -405,6 +405,7 @@ private:
|
|||
StmtResult ParseAsmStatement();
|
||||
StmtResult ParseObjCTryStmt(SourceLocation atLoc);
|
||||
StmtResult ParseObjCThrowStmt(SourceLocation atLoc);
|
||||
StmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc);
|
||||
void ParseAsmOperandsOpt(llvm::SmallVectorImpl<std::string> &Names,
|
||||
llvm::SmallVectorImpl<ExprTy*> &Constraints,
|
||||
llvm::SmallVectorImpl<ExprTy*> &Exprs);
|
||||
|
|
Загрузка…
Ссылка в новой задаче