diff options
author | Anna Zaks <ganna@apple.com> | 2012-10-01 20:34:04 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-10-01 20:34:04 +0000 |
commit | bbff82f302a1dd67589f65912351978905f0c5a7 (patch) | |
tree | 32e1bef6a7e5fa080bcbcdf9a71b9d410717763e /lib/AST/Expr.cpp | |
parent | b9733ac1a2012c3e909ac262073a6deb8533d2c7 (diff) |
Move isObjCSelf into Expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 30342585c8..e1198b85c5 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -3002,6 +3002,24 @@ const ObjCPropertyRefExpr *Expr::getObjCProperty() const { return cast<ObjCPropertyRefExpr>(E); } +bool Expr::isObjCSelfExpr() const { + const Expr *E = IgnoreParenImpCasts(); + + const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E); + if (!DRE) + return false; + + const ImplicitParamDecl *Param = dyn_cast<ImplicitParamDecl>(DRE->getDecl()); + if (!Param) + return false; + + const ObjCMethodDecl *M = dyn_cast<ObjCMethodDecl>(Param->getDeclContext()); + if (!M) + return false; + + return M->getSelfDecl() == Param; +} + FieldDecl *Expr::getBitField() { Expr *E = this->IgnoreParens(); |