aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-01-16 19:58:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-01-16 19:58:32 +0000
commitc55a24095c3488fa6e99b537be64e57a2905477b (patch)
tree840d890d9df00d8eab00a8585109dd3aec2788a9 /lib/AST/ASTContext.cpp
parent41c3ae108a54437f27fa99ddcb9bafcf113bde80 (diff)
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
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index fe868d0768..8e7410c47c 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2012,9 +2012,13 @@ void ASTContext::setObjCIdType(TypedefDecl *TD)
// 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 @@ void ASTContext::setObjCSelType(TypedefDecl *TD)
// 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;
}