r212004 - Basic: correct the va_list type on Windows on ARM
Saleem Abdulrasool
compnerd at compnerd.org
Sun Jun 29 16:05:41 PDT 2014
Author: compnerd
Date: Sun Jun 29 18:05:41 2014
New Revision: 212004
URL: http://llvm.org/viewvc/llvm-project?rev=212004&view=rev
Log:
Basic: correct the va_list type on Windows on ARM
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.
Added:
cfe/trunk/test/CodeGenCXX/windows-arm-valist.cpp
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=212004&r1=212003&r2=212004&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Jun 29 18:05:41 2014
@@ -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
Added: cfe/trunk/test/CodeGenCXX/windows-arm-valist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/windows-arm-valist.cpp?rev=212004&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/windows-arm-valist.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/windows-arm-valist.cpp Sun Jun 29 18:05:41 2014
@@ -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");
+}
More information about the cfe-commits
mailing list