29 lines · cpp
1// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple i686-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s -check-prefix=X86 -check-prefix=CHECK2// RUN: %clang_cc1 -Wno-error=non-pod-varargs -triple x86_64-pc-win32 -fms-compatibility -emit-llvm -o - %s | FileCheck %s -check-prefix=X64 -check-prefix=CHECK3 4struct X {5 X();6 ~X();7 int data;8};9 10void vararg(...);11 12void test(X x) {13 // CHECK-LABEL: define dso_local void @"?test@@YAXUX@@@Z"14 15 // X86: %[[argmem:[^ ]*]] = alloca inalloca <{ %struct.X }>16 // X86: call void (ptr, ...) @"?vararg@@YAXZZ"(ptr inalloca(<{ %struct.X }>) %[[argmem]])17 18 // X64: alloca %struct.X19 20 // X64: %[[agg:[^ ]*]] = alloca %struct.X21 // X64: %[[valptr:[^ ]*]] = getelementptr inbounds nuw %struct.X, ptr %[[agg]], i32 0, i32 022 // X64: %[[val:[^ ]*]] = load i32, ptr %[[valptr]]23 // X64: call void (...) @"?vararg@@YAXZZ"(i32 %[[val]])24 25 // CHECK-NOT: llvm.trap26 vararg(x);27 // CHECK: ret void28}29