-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang] Support MSPropertyRefExpr as placement arg to new-expression (#…
…75883) It seems we were forgetting to call `checkArgsForPlaceholders` on the placement arguments of new-expressions in Sema. I don't think that was intended—at least doing so doesn't seem to break anything—so this pr adds that. This also fixes #65053 --------- Co-authored-by: Erich Keane <ekeane@nvidia.com>
- Loading branch information
1 parent
04a69a1
commit af0ee61
Showing
14 changed files
with
375 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// RUN: %clang_cc1 -emit-llvm -triple=x86_64-pc-win32 -fms-compatibility %s -o - | FileCheck %s | ||
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -fms-compatibility -emit-pch -o %t %s | ||
// RUN: %clang_cc1 -emit-llvm -triple=x86_64-pc-win32 -fms-compatibility -include-pch %t -verify %s -o - | FileCheck %s | ||
// expected-no-diagnostics | ||
|
||
#ifndef HEADER | ||
#define HEADER | ||
|
||
struct S { | ||
int GetX() { return 42; } | ||
__declspec(property(get=GetX)) int x; | ||
|
||
int GetY(int i, int j) { return i+j; } | ||
__declspec(property(get=GetY)) int y[]; | ||
|
||
void* operator new(__SIZE_TYPE__, int); | ||
}; | ||
|
||
template <typename T> | ||
struct TS { | ||
T GetT() { return T(); } | ||
__declspec(property(get=GetT)) T t; | ||
|
||
T GetR(T i, T j) { return i+j; } | ||
__declspec(property(get=GetR)) T r[]; | ||
}; | ||
|
||
// CHECK-LABEL: main | ||
int main(int argc, char **argv) { | ||
S *s; | ||
TS<double> *ts; | ||
|
||
// CHECK: [[X:%.+]] = call noundef i32 @"?GetX@S@@QEAAHXZ"(ptr {{[^,]*}} %{{.+}}) | ||
// CHECK-NEXT: call noundef ptr @"??2S@@SAPEAX_KH@Z"(i64 noundef 1, i32 noundef [[X]]) | ||
new (s->x) S; | ||
|
||
// CHECK: [[Y:%.+]] = call noundef i32 @"?GetY@S@@QEAAHHH@Z"(ptr {{[^,]*}} %{{.+}}, i32 noundef 1, i32 noundef 2) | ||
// CHECK-NEXT: call noundef ptr @"??2S@@SAPEAX_KH@Z"(i64 noundef 1, i32 noundef [[Y]]) | ||
new ((s->y)[1][2]) S; | ||
|
||
// CHECK: [[T:%.+]] = call noundef double @"?GetT@?$TS@N@@QEAANXZ"(ptr {{[^,]*}} %{{.+}}) | ||
// CHECK-NEXT: [[TI:%.+]] = fptosi double [[T]] to i32 | ||
// CHECK-NEXT: call noundef ptr @"??2S@@SAPEAX_KH@Z"(i64 noundef 1, i32 noundef [[TI]]) | ||
new (ts->t) S; | ||
|
||
// CHECK: [[R:%.+]] = call noundef double @"?GetR@?$TS@N@@QEAANNN@Z"(ptr {{[^,]*}} %{{.+}}, double {{[^,]*}}, double {{[^,]*}}) | ||
// CHECK-NEXT: [[RI:%.+]] = fptosi double [[R]] to i32 | ||
// CHECK-NEXT: call noundef ptr @"??2S@@SAPEAX_KH@Z"(i64 noundef 1, i32 noundef [[RI]]) | ||
new ((ts->r)[1][2]) S; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -std=c++11 -emit-llvm -o - %s | FileCheck %s | ||
|
||
struct S { | ||
void* operator new(__SIZE_TYPE__, int); | ||
}; | ||
|
||
int main() { | ||
// CHECK: call {{.*}} ptr @"??2S@@SAPEAX_KH@Z"(i64 {{.*}} 1, i32 {{.*}} 0) | ||
// CHECK: call {{.*}} ptr @"??2S@@SAPEAX_KH@Z"(i64 {{.*}} 1, i32 {{.*}} 0) | ||
new (__noop) S; | ||
new ((__noop)) S; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// RUN: %clang_cc1 -x objective-c++ -std=c++11 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s | ||
|
||
// CHECK: [[NAME:@.*]] = private unnamed_addr constant [9 x i8] c"position\00" | ||
// CHECK: [[SEL:@.*]] = internal externally_initialized global ptr [[NAME]] | ||
|
||
@interface I { | ||
int position; | ||
} | ||
@property(nonatomic) int position; | ||
@end | ||
|
||
struct S { | ||
void *operator new(__SIZE_TYPE__, int); | ||
}; | ||
|
||
template <typename T> | ||
struct TS { | ||
void *operator new(__SIZE_TYPE__, T); | ||
}; | ||
|
||
I *GetI(); | ||
|
||
int main() { | ||
@autoreleasepool { | ||
// CHECK: [[I:%.+]] = alloca ptr | ||
auto* i = GetI(); | ||
i.position = 42; | ||
|
||
// This is so we can find the next line more easily. | ||
// CHECK: store double | ||
double d = 42.0; | ||
|
||
// CHECK: [[I1:%.+]] = load ptr, ptr [[I]] | ||
// CHECK-NEXT: [[SEL1:%.+]] = load ptr, ptr [[SEL]] | ||
// CHECK-NEXT: [[POS1:%.+]] = call {{.*}} i32 @objc_msgSend(ptr {{.*}} [[I1]], ptr {{.*}} [[SEL1]]) | ||
// CHECK-NEXT: call {{.*}} ptr @_ZN1SnwEmi(i64 {{.*}} 1, i32 {{.*}} [[POS1]]) | ||
new (i.position) S; | ||
|
||
// CHECK: [[I2:%.+]] = load ptr, ptr [[I]] | ||
// CHECK-NEXT: [[SEL2:%.+]] = load ptr, ptr [[SEL]] | ||
// CHECK-NEXT: [[POS2:%.+]] = call {{.*}} i32 @objc_msgSend(ptr {{.*}} [[I2]], ptr {{.*}} [[SEL2]]) | ||
// CHECK-NEXT: [[DBL:%.+]] = sitofp i32 [[POS2]] to double | ||
// CHECK-NEXT: call {{.*}} ptr @_ZN2TSIdEnwEmd(i64 {{.*}} 1, double {{.*}} [[DBL]]) | ||
new (i.position) TS<double>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.