Don't ICE on user redeclaration of objc's built-in types.
Issue diagnostics instead if types do not match.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62349 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index fe868d0..8e7410c 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2012,9 +2012,13 @@
// typedef struct objc_object *id;
const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
- assert(ptr && "'id' incorrectly typed");
+ // User error - caller will issue diagnostics.
+ if (!ptr)
+ return;
const RecordType *rec = ptr->getPointeeType()->getAsStructureType();
- assert(rec && "'id' incorrectly typed");
+ // User error - caller will issue diagnostics.
+ if (!rec)
+ return;
IdStructType = rec;
}
@@ -2024,9 +2028,11 @@
// typedef struct objc_selector *SEL;
const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
- assert(ptr && "'SEL' incorrectly typed");
+ if (!ptr)
+ return;
const RecordType *rec = ptr->getPointeeType()->getAsStructureType();
- assert(rec && "'SEL' incorrectly typed");
+ if (!rec)
+ return;
SelStructType = rec;
}