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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68441 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a4335ea..99afd32 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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