]> granicus.if.org Git - clang/commitdiff
fix code that incorrectly assumed that GetTypeForDeclarator cannot
authorChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 22:12:06 +0000 (22:12 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 22:12:06 +0000 (22:12 +0000)
return null.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68916 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 8ce624b78880bcc2ce05b1fa496a907279b3025d..6c2440ff68e4522d8a6556e0f0fb6176e21b42fb 100644 (file)
@@ -2678,9 +2678,11 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
   // type was invalid, GetTypeForDeclarator() still returns a "valid" type,
   // though it will not reflect the user specified type.
   QualType parmDeclType = GetTypeForDeclarator(D, S);
+  if (parmDeclType.isNull()) {
+    D.setInvalidType(true);
+    parmDeclType = Context.IntTy;
+  }
   
-  assert(!parmDeclType.isNull() && "GetTypeForDeclarator() returned null type");
-
   // TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
   // Can this happen for params?  We already checked that they don't conflict
   // among each other.  Here they can only shadow globals, which is ok.