From 27940d2fb346325d6001a7661e4ada099cd8e59c Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 30 Jul 2010 05:17:22 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaType.cpp | 6 ++++-- 1 file 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()) { // Silently drop any existing protocol qualifiers. // TODO: determine whether that's the right thing to do. -- 2.50.1