summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2015-01-20 20:41:36 +0000
committerBen Langmuir <blangmuir@apple.com>2015-01-20 20:41:36 +0000
commitc91ac9ed498eea96e135c3433e690edf5f951b74 (patch)
tree506eb01de2b7c3cc2346794f09ecd5a4d6c61a1a /clang/lib/Sema/SemaDecl.cpp
parente7d3dfdb754b8c6bd999f272b9b4b70c2aef538f (diff)
downloadbcm5719-llvm-c91ac9ed498eea96e135c3433e690edf5f951b74.tar.gz
bcm5719-llvm-c91ac9ed498eea96e135c3433e690edf5f951b74.zip
Fix crashes on missing @interface for category
In a few places we didn't check that Category->getClassInterface() was not null before using it. llvm-svn: 226605
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9eb5993f2a2..8fbe82fd881 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -13979,7 +13979,10 @@ Decl *Sema::getObjCDeclContext() const {
}
AvailabilityResult Sema::getCurContextAvailability() const {
- const Decl *D = cast<Decl>(getCurObjCLexicalContext());
+ 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,
OpenPOWER on IntegriCloud