зеркало из https://github.com/microsoft/clang-1.git
split ObjC and C++ Statements out into their own headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70105 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d5e3e8ec50
Коммит
16f0049415
|
@ -583,6 +583,8 @@
|
|||
DECB6D640F9AE26600F5FBC7 /* JumpDiagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JumpDiagnostics.cpp; path = lib/Sema/JumpDiagnostics.cpp; sourceTree = "<group>"; };
|
||||
DECB6F030F9D939A00F5FBC7 /* InitPreprocessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InitPreprocessor.h; path = clang/Frontend/InitPreprocessor.h; sourceTree = "<group>"; };
|
||||
DECB6F060F9D93A800F5FBC7 /* InitPreprocessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InitPreprocessor.cpp; path = lib/Frontend/InitPreprocessor.cpp; sourceTree = "<group>"; };
|
||||
DECB734E0FA3ED8400F5FBC7 /* StmtObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtObjC.h; path = clang/AST/StmtObjC.h; sourceTree = "<group>"; };
|
||||
DECB73550FA3EE5A00F5FBC7 /* StmtCXX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtCXX.h; path = clang/AST/StmtCXX.h; sourceTree = "<group>"; };
|
||||
DED626C80AE0C065001E80A4 /* TargetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; path = TargetInfo.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DED62ABA0AE2EDF1001E80A4 /* Decl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Decl.cpp; path = lib/AST/Decl.cpp; sourceTree = "<group>"; tabWidth = 2; usesTabs = 0; };
|
||||
DED676D00B6C786700AAD4A3 /* Builtins.def */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = text; name = Builtins.def; path = clang/AST/Builtins.def; sourceTree = "<group>"; tabWidth = 2; };
|
||||
|
@ -1126,7 +1128,9 @@
|
|||
3547129D0C88881300B3E1D5 /* PrettyPrinter.h */,
|
||||
DE6951C60C4D1F5D00A5826B /* RecordLayout.h */,
|
||||
DE3452800AEF1B1800DBC861 /* Stmt.h */,
|
||||
DECB73550FA3EE5A00F5FBC7 /* StmtCXX.h */,
|
||||
DE345F210AFD347900DBC861 /* StmtNodes.def */,
|
||||
DECB734E0FA3ED8400F5FBC7 /* StmtObjC.h */,
|
||||
DE345C190AFC658B00DBC861 /* StmtVisitor.h */,
|
||||
35847BE30CC7DB9000C40FFF /* StmtIterator.h */,
|
||||
35CFFE010CA1CBDD00E6F2BE /* StmtGraphTraits.h */,
|
||||
|
|
|
@ -1157,318 +1157,6 @@ public:
|
|||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCForCollectionStmt - This represents Objective-c's collection statement;
|
||||
/// represented as 'for (element 'in' collection-expression)' stmt.
|
||||
///
|
||||
class ObjCForCollectionStmt : public Stmt {
|
||||
enum { ELEM, COLLECTION, BODY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR]; // SubExprs[ELEM] is an expression or declstmt.
|
||||
SourceLocation ForLoc;
|
||||
SourceLocation RParenLoc;
|
||||
public:
|
||||
ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body,
|
||||
SourceLocation FCL, SourceLocation RPL);
|
||||
|
||||
Stmt *getElement() { return SubExprs[ELEM]; }
|
||||
Expr *getCollection() {
|
||||
return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
|
||||
}
|
||||
Stmt *getBody() { return SubExprs[BODY]; }
|
||||
|
||||
const Stmt *getElement() const { return SubExprs[ELEM]; }
|
||||
const Expr *getCollection() const {
|
||||
return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
|
||||
}
|
||||
const Stmt *getBody() const { return SubExprs[BODY]; }
|
||||
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd());
|
||||
}
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCForCollectionStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCForCollectionStmt *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtCatchStmt - This represents objective-c's @catch statement.
|
||||
class ObjCAtCatchStmt : public Stmt {
|
||||
private:
|
||||
enum { BODY, NEXT_CATCH, END_EXPR };
|
||||
ParmVarDecl *ExceptionDecl;
|
||||
Stmt *SubExprs[END_EXPR];
|
||||
SourceLocation AtCatchLoc, RParenLoc;
|
||||
|
||||
// Used by deserialization.
|
||||
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc)
|
||||
: Stmt(ObjCAtCatchStmtClass), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) {}
|
||||
|
||||
public:
|
||||
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
|
||||
ParmVarDecl *catchVarDecl,
|
||||
Stmt *atCatchStmt, Stmt *atCatchList);
|
||||
|
||||
const Stmt *getCatchBody() const { return SubExprs[BODY]; }
|
||||
Stmt *getCatchBody() { return SubExprs[BODY]; }
|
||||
|
||||
const ObjCAtCatchStmt *getNextCatchStmt() const {
|
||||
return static_cast<const ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
|
||||
}
|
||||
ObjCAtCatchStmt *getNextCatchStmt() {
|
||||
return static_cast<ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
|
||||
}
|
||||
|
||||
const ParmVarDecl *getCatchParamDecl() const {
|
||||
return ExceptionDecl;
|
||||
}
|
||||
ParmVarDecl *getCatchParamDecl() {
|
||||
return ExceptionDecl;
|
||||
}
|
||||
|
||||
SourceLocation getAtCatchLoc() const { return AtCatchLoc; }
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtCatchLoc, SubExprs[BODY]->getLocEnd());
|
||||
}
|
||||
|
||||
bool hasEllipsis() const { return getCatchParamDecl() == 0; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtCatchStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtCatchStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement
|
||||
class ObjCAtFinallyStmt : public Stmt {
|
||||
Stmt *AtFinallyStmt;
|
||||
SourceLocation AtFinallyLoc;
|
||||
public:
|
||||
ObjCAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt)
|
||||
: Stmt(ObjCAtFinallyStmtClass),
|
||||
AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {}
|
||||
|
||||
const Stmt *getFinallyBody() const { return AtFinallyStmt; }
|
||||
Stmt *getFinallyBody() { return AtFinallyStmt; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd());
|
||||
}
|
||||
|
||||
SourceLocation getAtFinallyLoc() const { return AtFinallyLoc; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtFinallyStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtFinallyStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtTryStmt - This represent objective-c's over-all
|
||||
/// @try ... @catch ... @finally statement.
|
||||
class ObjCAtTryStmt : public Stmt {
|
||||
private:
|
||||
enum { TRY, CATCH, FINALLY, END_EXPR };
|
||||
Stmt* SubStmts[END_EXPR];
|
||||
|
||||
SourceLocation AtTryLoc;
|
||||
public:
|
||||
ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
||||
Stmt *atCatchStmt,
|
||||
Stmt *atFinallyStmt)
|
||||
: Stmt(ObjCAtTryStmtClass) {
|
||||
SubStmts[TRY] = atTryStmt;
|
||||
SubStmts[CATCH] = atCatchStmt;
|
||||
SubStmts[FINALLY] = atFinallyStmt;
|
||||
AtTryLoc = atTryLoc;
|
||||
}
|
||||
|
||||
SourceLocation getAtTryLoc() const { return AtTryLoc; }
|
||||
const Stmt *getTryBody() const { return SubStmts[TRY]; }
|
||||
Stmt *getTryBody() { return SubStmts[TRY]; }
|
||||
const ObjCAtCatchStmt *getCatchStmts() const {
|
||||
return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
|
||||
}
|
||||
ObjCAtCatchStmt *getCatchStmts() {
|
||||
return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
|
||||
}
|
||||
const ObjCAtFinallyStmt *getFinallyStmt() const {
|
||||
return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
|
||||
}
|
||||
ObjCAtFinallyStmt *getFinallyStmt() {
|
||||
return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
|
||||
}
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtTryLoc, SubStmts[TRY]->getLocEnd());
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtTryStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtTryStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtSynchronizedStmt - This is for objective-c's @synchronized statement.
|
||||
/// Example: @synchronized (sem) {
|
||||
/// do-something;
|
||||
/// }
|
||||
///
|
||||
class ObjCAtSynchronizedStmt : public Stmt {
|
||||
private:
|
||||
enum { SYNC_EXPR, SYNC_BODY, END_EXPR };
|
||||
Stmt* SubStmts[END_EXPR];
|
||||
SourceLocation AtSynchronizedLoc;
|
||||
|
||||
public:
|
||||
ObjCAtSynchronizedStmt(SourceLocation atSynchronizedLoc, Stmt *synchExpr,
|
||||
Stmt *synchBody)
|
||||
: Stmt(ObjCAtSynchronizedStmtClass) {
|
||||
SubStmts[SYNC_EXPR] = synchExpr;
|
||||
SubStmts[SYNC_BODY] = synchBody;
|
||||
AtSynchronizedLoc = atSynchronizedLoc;
|
||||
}
|
||||
|
||||
SourceLocation getAtSynchronizedLoc() const { return AtSynchronizedLoc; }
|
||||
|
||||
const CompoundStmt *getSynchBody() const {
|
||||
return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
|
||||
}
|
||||
CompoundStmt *getSynchBody() {
|
||||
return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
|
||||
}
|
||||
|
||||
const Expr *getSynchExpr() const {
|
||||
return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
|
||||
}
|
||||
Expr *getSynchExpr() {
|
||||
return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
|
||||
}
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtSynchronizedLoc, getSynchBody()->getLocEnd());
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtSynchronizedStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtSynchronizedStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtThrowStmt - This represents objective-c's @throw statement.
|
||||
class ObjCAtThrowStmt : public Stmt {
|
||||
Stmt *Throw;
|
||||
SourceLocation AtThrowLoc;
|
||||
public:
|
||||
ObjCAtThrowStmt(SourceLocation atThrowLoc, Stmt *throwExpr)
|
||||
: Stmt(ObjCAtThrowStmtClass), Throw(throwExpr) {
|
||||
AtThrowLoc = atThrowLoc;
|
||||
}
|
||||
|
||||
const Expr *getThrowExpr() const { return reinterpret_cast<Expr*>(Throw); }
|
||||
Expr *getThrowExpr() { return reinterpret_cast<Expr*>(Throw); }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
if (Throw)
|
||||
return SourceRange(AtThrowLoc, Throw->getLocEnd());
|
||||
else
|
||||
return SourceRange(AtThrowLoc);
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtThrowStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtThrowStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// CXXCatchStmt - This represents a C++ catch block.
|
||||
class CXXCatchStmt : public Stmt {
|
||||
SourceLocation CatchLoc;
|
||||
/// The exception-declaration of the type.
|
||||
Decl *ExceptionDecl;
|
||||
/// The handler block.
|
||||
Stmt *HandlerBlock;
|
||||
|
||||
public:
|
||||
CXXCatchStmt(SourceLocation catchLoc, Decl *exDecl, Stmt *handlerBlock)
|
||||
: Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl),
|
||||
HandlerBlock(handlerBlock) {}
|
||||
|
||||
virtual void Destroy(ASTContext& Ctx);
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(CatchLoc, HandlerBlock->getLocEnd());
|
||||
}
|
||||
|
||||
Decl *getExceptionDecl() { return ExceptionDecl; }
|
||||
QualType getCaughtType();
|
||||
Stmt *getHandlerBlock() { return HandlerBlock; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXCatchStmtClass;
|
||||
}
|
||||
static bool classof(const CXXCatchStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// CXXTryStmt - A C++ try block, including all handlers.
|
||||
class CXXTryStmt : public Stmt {
|
||||
SourceLocation TryLoc;
|
||||
// First place is the guarded CompoundStatement. Subsequent are the handlers.
|
||||
// More than three handlers should be rare.
|
||||
llvm::SmallVector<Stmt*, 4> Stmts;
|
||||
|
||||
public:
|
||||
CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
|
||||
Stmt **handlers, unsigned numHandlers);
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(TryLoc, Stmts.back()->getLocEnd());
|
||||
}
|
||||
|
||||
CompoundStmt *getTryBlock() { return llvm::cast<CompoundStmt>(Stmts[0]); }
|
||||
const CompoundStmt *getTryBlock() const {
|
||||
return llvm::cast<CompoundStmt>(Stmts[0]);
|
||||
}
|
||||
|
||||
unsigned getNumHandlers() const { return Stmts.size() - 1; }
|
||||
CXXCatchStmt *getHandler(unsigned i) {
|
||||
return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
|
||||
}
|
||||
const CXXCatchStmt *getHandler(unsigned i) const {
|
||||
return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXTryStmtClass;
|
||||
}
|
||||
static bool classof(const CXXTryStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
//===--- StmtObjC.h - Classes for representing ObjC statements --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the Objective-C statement AST node classes.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_AST_STMTOBJC_H
|
||||
#define LLVM_CLANG_AST_STMTOBJC_H
|
||||
|
||||
#include "clang/AST/Stmt.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// ObjCForCollectionStmt - This represents Objective-c's collection statement;
|
||||
/// represented as 'for (element 'in' collection-expression)' stmt.
|
||||
///
|
||||
class ObjCForCollectionStmt : public Stmt {
|
||||
enum { ELEM, COLLECTION, BODY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR]; // SubExprs[ELEM] is an expression or declstmt.
|
||||
SourceLocation ForLoc;
|
||||
SourceLocation RParenLoc;
|
||||
public:
|
||||
ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body,
|
||||
SourceLocation FCL, SourceLocation RPL);
|
||||
|
||||
Stmt *getElement() { return SubExprs[ELEM]; }
|
||||
Expr *getCollection() {
|
||||
return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
|
||||
}
|
||||
Stmt *getBody() { return SubExprs[BODY]; }
|
||||
|
||||
const Stmt *getElement() const { return SubExprs[ELEM]; }
|
||||
const Expr *getCollection() const {
|
||||
return reinterpret_cast<Expr*>(SubExprs[COLLECTION]);
|
||||
}
|
||||
const Stmt *getBody() const { return SubExprs[BODY]; }
|
||||
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd());
|
||||
}
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCForCollectionStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCForCollectionStmt *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtCatchStmt - This represents objective-c's @catch statement.
|
||||
class ObjCAtCatchStmt : public Stmt {
|
||||
private:
|
||||
enum { BODY, NEXT_CATCH, END_EXPR };
|
||||
ParmVarDecl *ExceptionDecl;
|
||||
Stmt *SubExprs[END_EXPR];
|
||||
SourceLocation AtCatchLoc, RParenLoc;
|
||||
|
||||
// Used by deserialization.
|
||||
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc)
|
||||
: Stmt(ObjCAtCatchStmtClass), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) {}
|
||||
|
||||
public:
|
||||
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
|
||||
ParmVarDecl *catchVarDecl,
|
||||
Stmt *atCatchStmt, Stmt *atCatchList);
|
||||
|
||||
const Stmt *getCatchBody() const { return SubExprs[BODY]; }
|
||||
Stmt *getCatchBody() { return SubExprs[BODY]; }
|
||||
|
||||
const ObjCAtCatchStmt *getNextCatchStmt() const {
|
||||
return static_cast<const ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
|
||||
}
|
||||
ObjCAtCatchStmt *getNextCatchStmt() {
|
||||
return static_cast<ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
|
||||
}
|
||||
|
||||
const ParmVarDecl *getCatchParamDecl() const {
|
||||
return ExceptionDecl;
|
||||
}
|
||||
ParmVarDecl *getCatchParamDecl() {
|
||||
return ExceptionDecl;
|
||||
}
|
||||
|
||||
SourceLocation getAtCatchLoc() const { return AtCatchLoc; }
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtCatchLoc, SubExprs[BODY]->getLocEnd());
|
||||
}
|
||||
|
||||
bool hasEllipsis() const { return getCatchParamDecl() == 0; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtCatchStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtCatchStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtFinallyStmt - This represent objective-c's @finally Statement
|
||||
class ObjCAtFinallyStmt : public Stmt {
|
||||
Stmt *AtFinallyStmt;
|
||||
SourceLocation AtFinallyLoc;
|
||||
public:
|
||||
ObjCAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt)
|
||||
: Stmt(ObjCAtFinallyStmtClass),
|
||||
AtFinallyStmt(atFinallyStmt), AtFinallyLoc(atFinallyLoc) {}
|
||||
|
||||
const Stmt *getFinallyBody() const { return AtFinallyStmt; }
|
||||
Stmt *getFinallyBody() { return AtFinallyStmt; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtFinallyLoc, AtFinallyStmt->getLocEnd());
|
||||
}
|
||||
|
||||
SourceLocation getAtFinallyLoc() const { return AtFinallyLoc; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtFinallyStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtFinallyStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtTryStmt - This represent objective-c's over-all
|
||||
/// @try ... @catch ... @finally statement.
|
||||
class ObjCAtTryStmt : public Stmt {
|
||||
private:
|
||||
enum { TRY, CATCH, FINALLY, END_EXPR };
|
||||
Stmt* SubStmts[END_EXPR];
|
||||
|
||||
SourceLocation AtTryLoc;
|
||||
public:
|
||||
ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
||||
Stmt *atCatchStmt,
|
||||
Stmt *atFinallyStmt)
|
||||
: Stmt(ObjCAtTryStmtClass) {
|
||||
SubStmts[TRY] = atTryStmt;
|
||||
SubStmts[CATCH] = atCatchStmt;
|
||||
SubStmts[FINALLY] = atFinallyStmt;
|
||||
AtTryLoc = atTryLoc;
|
||||
}
|
||||
|
||||
SourceLocation getAtTryLoc() const { return AtTryLoc; }
|
||||
const Stmt *getTryBody() const { return SubStmts[TRY]; }
|
||||
Stmt *getTryBody() { return SubStmts[TRY]; }
|
||||
const ObjCAtCatchStmt *getCatchStmts() const {
|
||||
return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
|
||||
}
|
||||
ObjCAtCatchStmt *getCatchStmts() {
|
||||
return dyn_cast_or_null<ObjCAtCatchStmt>(SubStmts[CATCH]);
|
||||
}
|
||||
const ObjCAtFinallyStmt *getFinallyStmt() const {
|
||||
return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
|
||||
}
|
||||
ObjCAtFinallyStmt *getFinallyStmt() {
|
||||
return dyn_cast_or_null<ObjCAtFinallyStmt>(SubStmts[FINALLY]);
|
||||
}
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtTryLoc, SubStmts[TRY]->getLocEnd());
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtTryStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtTryStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtSynchronizedStmt - This is for objective-c's @synchronized statement.
|
||||
/// Example: @synchronized (sem) {
|
||||
/// do-something;
|
||||
/// }
|
||||
///
|
||||
class ObjCAtSynchronizedStmt : public Stmt {
|
||||
private:
|
||||
enum { SYNC_EXPR, SYNC_BODY, END_EXPR };
|
||||
Stmt* SubStmts[END_EXPR];
|
||||
SourceLocation AtSynchronizedLoc;
|
||||
|
||||
public:
|
||||
ObjCAtSynchronizedStmt(SourceLocation atSynchronizedLoc, Stmt *synchExpr,
|
||||
Stmt *synchBody)
|
||||
: Stmt(ObjCAtSynchronizedStmtClass) {
|
||||
SubStmts[SYNC_EXPR] = synchExpr;
|
||||
SubStmts[SYNC_BODY] = synchBody;
|
||||
AtSynchronizedLoc = atSynchronizedLoc;
|
||||
}
|
||||
|
||||
SourceLocation getAtSynchronizedLoc() const { return AtSynchronizedLoc; }
|
||||
|
||||
const CompoundStmt *getSynchBody() const {
|
||||
return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
|
||||
}
|
||||
CompoundStmt *getSynchBody() {
|
||||
return reinterpret_cast<CompoundStmt*>(SubStmts[SYNC_BODY]);
|
||||
}
|
||||
|
||||
const Expr *getSynchExpr() const {
|
||||
return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
|
||||
}
|
||||
Expr *getSynchExpr() {
|
||||
return reinterpret_cast<Expr*>(SubStmts[SYNC_EXPR]);
|
||||
}
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(AtSynchronizedLoc, getSynchBody()->getLocEnd());
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtSynchronizedStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtSynchronizedStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ObjCAtThrowStmt - This represents objective-c's @throw statement.
|
||||
class ObjCAtThrowStmt : public Stmt {
|
||||
Stmt *Throw;
|
||||
SourceLocation AtThrowLoc;
|
||||
public:
|
||||
ObjCAtThrowStmt(SourceLocation atThrowLoc, Stmt *throwExpr)
|
||||
: Stmt(ObjCAtThrowStmtClass), Throw(throwExpr) {
|
||||
AtThrowLoc = atThrowLoc;
|
||||
}
|
||||
|
||||
const Expr *getThrowExpr() const { return reinterpret_cast<Expr*>(Throw); }
|
||||
Expr *getThrowExpr() { return reinterpret_cast<Expr*>(Throw); }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
if (Throw)
|
||||
return SourceRange(AtThrowLoc, Throw->getLocEnd());
|
||||
else
|
||||
return SourceRange(AtThrowLoc);
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == ObjCAtThrowStmtClass;
|
||||
}
|
||||
static bool classof(const ObjCAtThrowStmt *) { return true; }
|
||||
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/AST/ExprObjC.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace clang {
|
|||
|
||||
class PathDiagnosticClient;
|
||||
class Diagnostic;
|
||||
class ObjCForCollectionStmt;
|
||||
|
||||
class GRExprEngine {
|
||||
public:
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "clang/AST/Stmt.h"
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/AST/ExprObjC.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/ASTDiagnostic.h"
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
#include "clang/Analysis/PathSensitive/BugReporter.h"
|
||||
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/CFG.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/ParentMap.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Analysis/ProgramPoint.h"
|
||||
#include "clang/Analysis/PathDiagnostic.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/AST/ParentMap.h"
|
||||
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
|
||||
#include "clang/Analysis/PathSensitive/GRExprEngineBuilders.h"
|
||||
#include "clang/Analysis/PathSensitive/BugReporter.h"
|
||||
#include "clang/AST/ParentMap.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/PrettyStackTrace.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
#include "CodeGenModule.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/Basic/Diagnostic.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
|
||||
#include "llvm/Intrinsics.h"
|
||||
|
|
|
@ -50,6 +50,10 @@ namespace clang {
|
|||
class ObjCPropertyImplDecl;
|
||||
class TargetInfo;
|
||||
class VarDecl;
|
||||
class ObjCForCollectionStmt;
|
||||
class ObjCAtTryStmt;
|
||||
class ObjCAtThrowStmt;
|
||||
class ObjCAtSynchronizedStmt;
|
||||
|
||||
namespace CodeGen {
|
||||
class CodeGenModule;
|
||||
|
|
|
@ -1253,7 +1253,6 @@ void PCHStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
|
|||
void PCHStmtWriter::VisitObjCSuperExpr(ObjCSuperExpr *E) {
|
||||
VisitExpr(E);
|
||||
Writer.AddSourceLocation(E->getLoc(), Record);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "Sema.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
using namespace clang;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/StmtObjC.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
using namespace clang;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче