summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index b76fc5cf38a..094110fecf8 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -415,7 +415,9 @@ bool ObjCInterfaceDecl::inheritsDesignatedInitializers() const {
void ObjCInterfaceDecl::getDesignatedInitializers(
llvm::SmallVectorImpl<const ObjCMethodDecl *> &Methods) const {
- assert(hasDefinition());
+ // Check for a complete definition and recover if not so.
+ if (!isThisDeclarationADefinition())
+ return;
if (data().ExternallyCompleted)
LoadExternalDefinition();
@@ -433,7 +435,9 @@ void ObjCInterfaceDecl::getDesignatedInitializers(
bool ObjCInterfaceDecl::isDesignatedInitializer(Selector Sel,
const ObjCMethodDecl **InitMethod) const {
- assert(hasDefinition());
+ // Check for a complete definition and recover if not so.
+ if (!isThisDeclarationADefinition())
+ return false;
if (data().ExternallyCompleted)
LoadExternalDefinition();
@@ -1197,12 +1201,16 @@ void ObjCInterfaceDecl::setExternallyCompleted() {
}
void ObjCInterfaceDecl::setHasDesignatedInitializers() {
- assert(hasDefinition() && "Forward declarations can't contain methods");
+ // Check for a complete definition and recover if not so.
+ if (!isThisDeclarationADefinition())
+ return;
data().HasDesignatedInitializers = true;
}
bool ObjCInterfaceDecl::hasDesignatedInitializers() const {
- assert(hasDefinition() && "Forward declarations can't contain methods");
+ // Check for a complete definition and recover if not so.
+ if (!isThisDeclarationADefinition())
+ return false;
if (data().ExternallyCompleted)
LoadExternalDefinition();
OpenPOWER on IntegriCloud