annotate clang/test/CodeGenCXX/microsoft-new.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents c4bab56944e8
children
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];
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
16 // CHECK: call noundef ptr @"??2@YAPAXIUarbitrary_t@@@Z"(i32 noundef 16, ptr
150
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];
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
25 // CHECK: call noundef ptr @"??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 noundef 2, ptr
150
anatofuz
parents:
diff changeset
26 S *s1 = new(arbitrary) S;
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
27 // CHECK: call noundef ptr @"??2@YAPAXIUarbitrary_t@@@Z"(i32 noundef 1, ptr
150
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];
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
37 // CHECK: call noundef ptr @"??_U@YAPAXIUarbitrary2_t@@@Z"(i32 noundef 2, ptr
150
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 }