From: Chris Lattner Date: Sun, 12 Apr 2009 22:12:06 +0000 (+0000) Subject: fix code that incorrectly assumed that GetTypeForDeclarator cannot X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=798d5696ef5b4e3f47a6bed3c4f68f34c4810745;p=clang fix code that incorrectly assumed that GetTypeForDeclarator cannot return null. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68916 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8ce624b788..6c2440ff68 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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.