]> granicus.if.org Git - clang/commitdiff
Basic: correct the va_list type on Windows on ARM
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 29 Jun 2014 23:05:41 +0000 (23:05 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 29 Jun 2014 23:05:41 +0000 (23:05 +0000)
Windows on ARM defines va_list as a typedef for char *.  Although the semantics
of argument passing for variadic functions matches AAPCS VFP, the wrapped
struct __va_list type is unused.  This makes the intrinsic definition for
va_list match that of Visual Studio.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212004 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/CodeGenCXX/windows-arm-valist.cpp [new file with mode: 0644]

index dae4f767f877f35270085493b0114d465c68e112..34608f17a12ce31d3587ceb7a479050ad6233b5b 100644 (file)
@@ -4231,6 +4231,9 @@ public:
     // 31: VFPv3 40: VFPv4
     Builder.defineMacro("_M_ARM_FP", "31");
   }
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+    return TargetInfo::CharPtrBuiltinVaList;
+  }
 };
 
 // Windows ARM + Itanium C++ ABI Target
diff --git a/test/CodeGenCXX/windows-arm-valist.cpp b/test/CodeGenCXX/windows-arm-valist.cpp
new file mode 100644 (file)
index 0000000..6e31fed
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple thumbv7--windows-msvc -std=c++11 -fsyntax-only -fms-compatibility -x c++ %s
+
+#include <stdarg.h>
+
+template <typename lhs_, typename rhs_>
+struct is_same { enum { value = 0 }; };
+
+template <typename type_>
+struct is_same<type_, type_> { enum { value = 1 }; };
+
+void check() {
+  va_list va;
+  char *cp;
+  static_assert(is_same<decltype(va), decltype(cp)>::value,
+                "type mismatch for va_list");
+}