[cfe-commits] r68441 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/varargs-x86-64.c

Chris Lattner sabre at nondot.org
Sun Apr 5 08:49:55 PDT 2009


Author: lattner
Date: Sun Apr  5 10:49:53 2009
New Revision: 68441

URL: http://llvm.org/viewvc/llvm-project?rev=68441&view=rev
Log:
in va_arg diagnostics, print out the unpromoted type.  This makes the 
diagnostic use the va_list typedef more often, see the difference in the 
changed testcase.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/Sema/varargs-x86-64.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=68441&r1=68440&r2=68441&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Apr  5 10:49:53 2009
@@ -4710,7 +4710,9 @@
                                         ExprArg expr, TypeTy *type,
                                         SourceLocation RPLoc) {
   QualType T = QualType::getFromOpaquePtr(type);
-
+  Expr *E = static_cast<Expr*>(expr.get());
+  Expr *OrigExpr = E;
+  
   InitBuiltinVaListType();
 
   // Get the va_list type
@@ -4721,7 +4723,6 @@
   if (VaListType->isArrayType())
     VaListType = Context.getArrayDecayedType(VaListType);
   // Make sure the input expression also decays appropriately.
-  Expr *E = static_cast<Expr*>(expr.get());
   UsualUnaryConversions(E);
 
   AssignConvertType ConvResult = 
@@ -4730,13 +4731,13 @@
   case Compatible: break;  // Everything good.
   case CompatiblePointerDiscardsQualifiers:
     Diag(E->getLocStart(), diag::warn_va_arg_with_qualified_va_list)
-      << E->getType() << E->getSourceRange();
+      << OrigExpr->getType() << E->getSourceRange();
     break;
 
   default:
     return ExprError(Diag(E->getLocStart(),
                          diag::err_first_argument_to_va_arg_not_of_type_va_list)
-      << E->getType() << E->getSourceRange());
+      << OrigExpr->getType() << E->getSourceRange());
   }
 
   // FIXME: Check that type is complete/non-abstract

Modified: cfe/trunk/test/Sema/varargs-x86-64.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/varargs-x86-64.c?rev=68441&r1=68440&r2=68441&view=diff

==============================================================================
--- cfe/trunk/test/Sema/varargs-x86-64.c (original)
+++ cfe/trunk/test/Sema/varargs-x86-64.c Sun Apr  5 10:49:53 2009
@@ -3,6 +3,6 @@
 // rdar://6726818
 void f1() {
   const __builtin_va_list args2;
-  (void)__builtin_va_arg(args2, int); // expected-warning {{va_arg applied to va_list type 'struct __va_list_tag const *' with unexpected qualifiers}}
+  (void)__builtin_va_arg(args2, int); // expected-warning {{va_arg applied to va_list type '__builtin_va_list const' with unexpected qualifiers}}
 }
 





More information about the cfe-commits mailing list