[cfe-commits] r159290 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGen/varargs.c

Richard Smith richard-llvm at metafoo.co.uk
Wed Jun 27 13:23:58 PDT 2012


Author: rsmith
Date: Wed Jun 27 15:23:58 2012
New Revision: 159290

URL: http://llvm.org/viewvc/llvm-project?rev=159290&view=rev
Log:
Check for non-POD vararg argument type after default argument promotion, not
before, so we don't incorrectly think arguments of function type are non-POD.

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

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=159290&r1=159289&r2=159290&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jun 27 15:23:58 2012
@@ -679,7 +679,7 @@
 
   // Diagnostics regarding non-POD argument types are
   // emitted along with format string checking in Sema::CheckFunctionCall().
-  if (isValidVarArgType(Ty) == VAK_Invalid) {
+  if (isValidVarArgType(E->getType()) == VAK_Invalid) {
     // Turn this into a trap.
     CXXScopeSpec SS;
     SourceLocation TemplateKWLoc;

Modified: cfe/trunk/test/CodeGen/varargs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/varargs.c?rev=159290&r1=159289&r2=159290&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/varargs.c (original)
+++ cfe/trunk/test/CodeGen/varargs.c Wed Jun 27 15:23:58 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
 
 
 // PR6433 - Don't crash on va_arg(typedef).
@@ -9,3 +9,9 @@
     mfloat = __builtin_va_arg((pa), gdouble);
 }
 
+void vararg(int, ...);
+void function_as_vararg() {
+  // CHECK: define {{.*}}function_as_vararg
+  // CHECK-NOT: llvm.trap
+  vararg(0, focus_changed_cb);
+}





More information about the cfe-commits mailing list