r194197 - Fixed bug in return type of __builtin_va_start().

Enea Zaffanella zaffanella at cs.unipr.it
Thu Nov 7 00:14:27 PST 2013


Author: enea
Date: Thu Nov  7 02:14:26 2013
New Revision: 194197

URL: http://llvm.org/viewvc/llvm-project?rev=194197&view=rev
Log:
Fixed bug in return type of __builtin_va_start().

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp
    cfe/trunk/test/Sema/varargs.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=194197&r1=194196&r2=194197&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Nov  7 02:14:26 2013
@@ -1651,6 +1651,7 @@ bool Sema::SemaBuiltinVAStart(CallExpr *
     Diag(ParamLoc, diag::note_parameter_type) << Type;
   }
 
+  TheCall->setType(Context.VoidTy);
   return false;
 }
 

Modified: cfe/trunk/test/Sema/varargs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/varargs.c?rev=194197&r1=194196&r2=194197&view=diff
==============================================================================
--- cfe/trunk/test/Sema/varargs.c (original)
+++ cfe/trunk/test/Sema/varargs.c Thu Nov  7 02:14:26 2013
@@ -76,3 +76,10 @@ void f9(__builtin_va_list args)
     (void)__builtin_va_arg(args, short); // expected-warning {{second argument to 'va_arg' is of promotable type 'short'}}
     (void)__builtin_va_arg(args, char); // expected-warning {{second argument to 'va_arg' is of promotable type 'char'}}
 }
+
+void f10(int a, ...) {
+  int i;
+  __builtin_va_list ap;
+  i = __builtin_va_start(ap, a); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+  __builtin_va_end(ap);
+}





More information about the cfe-commits mailing list