diff options
| author | Erik Pilkington <erik.pilkington@gmail.com> | 2016-10-14 19:08:01 +0000 |
|---|---|---|
| committer | Erik Pilkington <erik.pilkington@gmail.com> | 2016-10-14 19:08:01 +0000 |
| commit | 88eff2575e77b2a67ae394f95e3850d3c746ad28 (patch) | |
| tree | 549b3b3f05175a772395e0d776cc5f068500280f /clang/lib/Sema/SemaDecl.cpp | |
| parent | 775a20913d1547e0dad374bf44733c200afa8132 (diff) | |
| download | bcm5719-llvm-88eff2575e77b2a67ae394f95e3850d3c746ad28.tar.gz bcm5719-llvm-88eff2575e77b2a67ae394f95e3850d3c746ad28.zip | |
[Sema] Refactor context checking for availability diagnostics
This commit combines a couple of redundant functions that do availability
attribute context checking into a more correct/simpler one.
Differential revision: https://reviews.llvm.org/D25283
llvm-svn: 284265
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a3444cbdc63..4536fe8df8a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -15615,29 +15615,3 @@ void Sema::ActOnPragmaWeakAlias(IdentifierInfo* Name, Decl *Sema::getObjCDeclContext() const { return (dyn_cast_or_null<ObjCContainerDecl>(CurContext)); } - -AvailabilityResult Sema::getCurContextAvailability() const { - const Decl *D = cast_or_null<Decl>(getCurObjCLexicalContext()); - if (!D) - return AR_Available; - - // If we are within an Objective-C method, we should consult - // both the availability of the method as well as the - // enclosing class. If the class is (say) deprecated, - // the entire method is considered deprecated from the - // purpose of checking if the current context is deprecated. - if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { - AvailabilityResult R = MD->getAvailability(); - if (R != AR_Available) - return R; - D = MD->getClassInterface(); - } - // If we are within an Objective-c @implementation, it - // gets the same availability context as the @interface. - else if (const ObjCImplementationDecl *ID = - dyn_cast<ObjCImplementationDecl>(D)) { - D = ID->getClassInterface(); - } - // Recover from user error. - return D ? D->getAvailability() : AR_Available; -} |

