[cfe-commits] r40169 - /cfe/trunk/Sema/SemaType.cpp

Chris Lattner sabre at nondot.org
Fri Jul 20 22:30:18 PDT 2007


Author: lattner
Date: Sat Jul 21 00:30:18 2007
New Revision: 40169

URL: http://llvm.org/viewvc/llvm-project?rev=40169&view=rev
Log:
recover from void argument types more nicely.

Modified:
    cfe/trunk/Sema/SemaType.cpp

Modified: cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaType.cpp?rev=40169&r1=40168&r2=40169&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/trunk/Sema/SemaType.cpp Sat Jul 21 00:30:18 2007
@@ -192,8 +192,7 @@
         
         for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
           QualType ArgTy = QualType::getFromOpaquePtr(FTI.ArgInfo[i].TypeInfo);
-          if (ArgTy.isNull())
-            return QualType();  // Error occurred parsing argument type.
+          assert(!ArgTy.isNull() && "Couldn't parse type?");
           
           // Look for 'void'.  void is allowed only as a single argument to a
           // function with no other parameters (C99 6.7.5.3p10).  We record
@@ -205,11 +204,13 @@
             if (FTI.NumArgs != 1 || FTI.isVariadic) {
               Diag(DeclType.Loc, diag::err_void_only_param);
               ArgTy = Context.IntTy;
+              FTI.ArgInfo[i].TypeInfo = ArgTy.getAsOpaquePtr();
             } else if (FTI.ArgInfo[i].Ident) {
               // Reject, but continue to parse 'int(void abc)'.
               Diag(FTI.ArgInfo[i].IdentLoc,
                    diag::err_param_with_void_type);
               ArgTy = Context.IntTy;
+              FTI.ArgInfo[i].TypeInfo = ArgTy.getAsOpaquePtr();
             } else {
               // Reject, but continue to parse 'float(const void)'.
               if (ArgTy.getQualifiers())





More information about the cfe-commits mailing list