aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-07-30 05:17:22 +0000
committerJohn McCall <rjmccall@apple.com>2010-07-30 05:17:22 +0000
commit27940d2fb346325d6001a7661e4ada099cd8e59c (patch)
tree6c062dd733a4fd0c65849dfe1488a542a053b306 /lib/Sema/SemaType.cpp
parent85aca0f6a9da02bda705690fd56d0aa713604f08 (diff)
If a TST_typename has a null type, mark the declarator invalid. Prevents
some downstream crashes, among them rdar://problem/8229840. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index d3715aad97..feff524143 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -298,8 +298,10 @@ static QualType ConvertDeclSpecToType(Sema &TheSema,
DS.getTypeSpecSign() == 0 &&
"Can't handle qualifiers on typedef names yet!");
Result = TheSema.GetTypeFromParser(DS.getTypeRep());
-
- if (DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers()) {
+ if (Result.isNull())
+ TheDeclarator.setInvalidType(true);
+ else if (DeclSpec::ProtocolQualifierListTy PQ
+ = DS.getProtocolQualifiers()) {
if (const ObjCObjectType *ObjT = Result->getAs<ObjCObjectType>()) {
// Silently drop any existing protocol qualifiers.
// TODO: determine whether that's the right thing to do.