annotate clang/test/CodeGenCXX/microsoft-new.cpp @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #include <stddef.h>
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 struct arbitrary_t {} arbitrary;
anatofuz
parents:
diff changeset
6 void *operator new(size_t size, arbitrary_t);
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 struct arbitrary2_t {} arbitrary2;
anatofuz
parents:
diff changeset
9 void *operator new[](size_t size, arbitrary2_t);
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 namespace PR13164 {
anatofuz
parents:
diff changeset
12 void f() {
anatofuz
parents:
diff changeset
13 // MSVC will fall back on the non-array operator new.
anatofuz
parents:
diff changeset
14 void *a;
anatofuz
parents:
diff changeset
15 int *p = new(arbitrary) int[4];
anatofuz
parents:
diff changeset
16 // CHECK: call i8* @"??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t*
anatofuz
parents:
diff changeset
17 }
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 struct S {
anatofuz
parents:
diff changeset
20 void *operator new[](size_t size, arbitrary_t);
anatofuz
parents:
diff changeset
21 };
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void g() {
anatofuz
parents:
diff changeset
24 S *s = new(arbitrary) S[2];
anatofuz
parents:
diff changeset
25 // CHECK: call i8* @"??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t*
anatofuz
parents:
diff changeset
26 S *s1 = new(arbitrary) S;
anatofuz
parents:
diff changeset
27 // CHECK: call i8* @"??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t*
anatofuz
parents:
diff changeset
28 }
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 struct T {
anatofuz
parents:
diff changeset
31 void *operator new(size_t size, arbitrary2_t);
anatofuz
parents:
diff changeset
32 };
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 void h() {
anatofuz
parents:
diff changeset
35 // This should still call the global operator new[].
anatofuz
parents:
diff changeset
36 T *t = new(arbitrary2) T[2];
anatofuz
parents:
diff changeset
37 // CHECK: call i8* @"??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t*
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 }