Fix rdar://6252231 - cannot call vsnprintf with va_list on x86_64,
by decaying __builtin_va_list's type when forming builtins.  On
x86-64 (and other targets) __builtin_va_list is a typedef for
an array.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56768 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp
index 8249c41..31e099a 100644
--- a/lib/AST/Builtins.cpp
+++ b/lib/AST/Builtins.cpp
@@ -137,6 +137,9 @@
   case 'a':
     Type = Context.getBuiltinVaListType();
     assert(!Type.isNull() && "builtin va list type not initialized!");
+    // Do array -> pointer decay.  The builtin should use the decayed type.
+    if (Type->isArrayType())
+      Type = Context.getArrayDecayedType(Type);
     break;
   case 'V': {
     char *End;