[cfe-commits] r109850 - /cfe/trunk/lib/Sema/SemaType.cpp

John McCall rjmccall at apple.com
Thu Jul 29 22:17:22 PDT 2010


Author: rjmccall
Date: Fri Jul 30 00:17:22 2010
New Revision: 109850

URL: http://llvm.org/viewvc/llvm-project?rev=109850&view=rev
Log:
If a TST_typename has a null type, mark the declarator invalid.  Prevents
some downstream crashes, among them rdar://problem/8229840.


Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=109850&r1=109849&r2=109850&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Jul 30 00:17:22 2010
@@ -298,8 +298,10 @@
            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.





More information about the cfe-commits mailing list