From: John McCall Date: Fri, 30 Jul 2010 05:17:22 +0000 (+0000) Subject: If a TST_typename has a null type, mark the declarator invalid. Prevents X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27940d2fb346325d6001a7661e4ada099cd8e59c;p=clang 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 --- 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.