Arthur Eubanks | ce7d3e1 | 2020-06-08 19:07:59 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fexceptions -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm %s -o - | FileCheck %s |
| 2 | |
| 3 | struct Foo { |
| 4 | int x; |
| 5 | }; |
| 6 | struct Bar { |
| 7 | int y; |
| 8 | }; |
| 9 | extern Foo *gv_foo; |
| 10 | extern Bar *gv_bar; |
| 11 | extern "C" void doit() { |
| 12 | gv_foo = new Foo(); |
| 13 | gv_bar = new Bar(); |
| 14 | } |
| 15 | |
| 16 | // CHECK-LABEL: define {{.*}}void @doit |
| 17 | // CHECK: call {{.*}} i8* {{.*}}@"??2@YAPEAX_K@Z"(i64 4) {{.*}} !heapallocsite [[DBG_FOO:!.*]] |
| 18 | // CHECK: call {{.*}} i8* {{.*}}@"??2@YAPEAX_K@Z"(i64 4) {{.*}} !heapallocsite [[DBG_BAR:!.*]] |
| 19 | |
| 20 | extern "C" void useinvoke() { |
| 21 | struct HasDtor { |
| 22 | ~HasDtor() { delete gv_foo; } |
| 23 | } o; |
| 24 | gv_foo = new Foo(); |
| 25 | } |
| 26 | |
| 27 | // CHECK-LABEL: define {{.*}}void @useinvoke |
| 28 | // CHECK: invoke {{.*}} i8* {{.*}}@"??2@YAPEAX_K@Z"(i64 4) |
| 29 | // CHECK-NEXT: to label {{.*}} unwind label {{.*}} !heapallocsite [[DBG_FOO]] |
| 30 | |
| 31 | // CHECK: [[DBG_FOO]] = distinct !DICompositeType(tag: DW_TAG_structure_type, |
| 32 | // CHECK-SAME: name: "Foo" |
| 33 | // CHECK: [[DBG_BAR]] = distinct !DICompositeType(tag: DW_TAG_structure_type, |
| 34 | // CHECK-SAME: name: "Bar" |
| 35 | |
| 36 | // a new expression in a default arg has caused crashes in the past, add here to test that edge case |
| 37 | void foo(int *a = new int) {} |
| 38 | void bar() { foo(); } |