[cfe-commits] r117353 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Douglas Gregor dgregor at apple.com
Mon Oct 25 22:45:40 PDT 2010


Author: dgregor
Date: Tue Oct 26 00:45:40 2010
New Revision: 117353

URL: http://llvm.org/viewvc/llvm-project?rev=117353&view=rev
Log:
Delay complete-type checking for arguments to no-prototype functions
until after we've checked/promoted the argument. Hopefully fixes the
Emacs regression due to my recent change that expanded type-checking
in the presence of K&R function definitions.

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

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=117353&r1=117352&r2=117353&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Oct 26 00:45:40 2010
@@ -3858,12 +3858,6 @@
       Expr *Arg = Args[i];
 
       if (Proto && i < Proto->getNumArgs()) {
-        if (RequireCompleteType(Arg->getSourceRange().getBegin(),
-                                Arg->getType(),
-                                PDiag(diag::err_call_incomplete_argument)
-                                  << Arg->getSourceRange()))
-          return ExprError();
-
         InitializedEntity Entity
           = InitializedEntity::InitializeParameter(Context, 
                                                    Proto->getArgType(i));
@@ -3877,14 +3871,14 @@
 
       } else {
         DefaultArgumentPromotion(Arg);
-
-        if (RequireCompleteType(Arg->getSourceRange().getBegin(),
-                                Arg->getType(),
-                                PDiag(diag::err_call_incomplete_argument)
-                                  << Arg->getSourceRange()))
-          return ExprError();
       }
       
+      if (RequireCompleteType(Arg->getSourceRange().getBegin(),
+                              Arg->getType(),
+                              PDiag(diag::err_call_incomplete_argument)
+                                << Arg->getSourceRange()))
+        return ExprError();
+
       TheCall->setArg(i, Arg);
     }
   }





More information about the cfe-commits mailing list