[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / operator-new.cpp
blob1d7887146705e4d9bbf3a2855c4b38a7029ba909
1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o %t-1.ll %s
2 // RUN: FileCheck --check-prefix=ALL -check-prefix SANE --input-file=%t-1.ll %s
3 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -fno-assume-sane-operator-new -o %t-2.ll %s
4 // RUN: FileCheck --check-prefix=ALL -check-prefix SANENOT --input-file=%t-2.ll %s
6 class teste {
7 int A;
8 public:
9 teste() : A(2) {}
12 void f1() {
13 // ALL: declare noundef nonnull ptr @_Znwj(
14 new teste();
17 // operator new should check for overflow in multiply.
18 void *f2(long N) {
19 return new int[N];
21 // ALL: [[UWO:%.*]] = call {{.*}} @llvm.umul.with.overflow
22 // ALL-NEXT: [[OVER:%.*]] = extractvalue {{.*}} [[UWO]], 1
23 // ALL-NEXT: [[SUM:%.*]] = extractvalue {{.*}} [[UWO]], 0
24 // ALL-NEXT: [[RESULT:%.*]] = select i1 [[OVER]], i32 -1, i32 [[SUM]]
25 // SANE-NEXT: call noalias noundef nonnull ptr @_Znaj(i32 noundef [[RESULT]])
26 // SANENOT-NEXT: call noundef nonnull ptr @_Znaj(i32 noundef [[RESULT]])
29 // ALL: declare noundef nonnull ptr @_Znaj(