]> granicus.if.org Git - clang/commitdiff
If a TST_typename has a null type, mark the declarator invalid. Prevents
authorJohn McCall <rjmccall@apple.com>
Fri, 30 Jul 2010 05:17:22 +0000 (05:17 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 30 Jul 2010 05:17:22 +0000 (05:17 +0000)
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

index d3715aad974464c1dfc752ea5d9cd59e52d1fb13..feff5241432ee10439e30272de8307411cadf29b 100644 (file)
@@ -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.