]> granicus.if.org Git - clang/commitdiff
GetTypeForDeclarator can return null on error now, handle this.
authorChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2009 23:13:55 +0000 (23:13 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 19 Feb 2009 23:13:55 +0000 (23:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65076 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index f3eb201fa2224c02b2697d4fb31043247c61337b..7b54b8bc7c84bfd104de232162f6a61c35191c13 100644 (file)
@@ -1376,7 +1376,10 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl,
     PrevDecl = 0;
 
   QualType R = GetTypeForDeclarator(D, S);
-  assert(!R.isNull() && "GetTypeForDeclarator() returned null type");
+  if (R.isNull()) {
+    InvalidDecl = true;
+    R = Context.IntTy;
+  }
 
   bool Redeclaration = false;
   if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef) {