"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/test/CodeGenCXX/constructor-direct-call.cpp" (6 Feb 2019, 2432 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "constructor-direct-call.cpp": 8.0.1_vs_9.0.0.

    1 // RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK32 --check-prefix=CHECK
    2 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc19.11.0 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK64 --check-prefix=CHECK
    3 
    4 class Test1 {
    5 public:
    6    int a;
    7 };
    8 
    9 void f1() {
   10   Test1 var;
   11   var.Test1::Test1();
   12 
   13   // CHECK32:   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 4, i1 false)
   14   // CHECK64:   call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 4, i1 false)
   15   var.Test1::Test1(var);
   16 }
   17 
   18 class Test2 {
   19 public:
   20   Test2() { a = 10; b = 10; }
   21    int a;
   22    int b;
   23 };
   24 
   25 void f2() {
   26   // CHECK:  %var = alloca %class.Test2, align 4
   27   // CHECK32-NEXT:  call x86_thiscallcc void @_ZN5Test2C1Ev(%class.Test2* %var)
   28   // CHECK64-NEXT:  %call = call %class.Test2* @"??0Test2@@QEAA@XZ"(%class.Test2* %var)
   29   Test2 var;
   30 
   31   // CHECK32-NEXT:  call x86_thiscallcc void @_ZN5Test2C1Ev(%class.Test2* %var)
   32   // CHECK64-NEXT:  %call1 = call %class.Test2* @"??0Test2@@QEAA@XZ"(%class.Test2* %var)
   33   var.Test2::Test2();
   34 
   35   // CHECK32:  call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 8, i1 false)
   36   // CHECK64:  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 8, i1 false)
   37   var.Test2::Test2(var);
   38 }
   39 
   40 
   41 
   42 
   43 class Test3 {
   44 public:
   45   Test3() { a = 10; b = 15; c = 20; }
   46   Test3(const Test3& that) { a = that.a; b = that.b; c = that.c; }
   47    int a;
   48    int b;
   49    int c;
   50 };
   51 
   52 void f3() {
   53   // CHECK32: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var)
   54   // CHECK64: %call = call %class.Test3* @"??0Test3@@QEAA@XZ"(%class.Test3* %var)
   55   Test3 var;
   56 
   57   // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var2)
   58   // CHECK64-NEXT: %call1 = call %class.Test3* @"??0Test3@@QEAA@XZ"(%class.Test3* %var2)
   59   Test3 var2;
   60 
   61   // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1Ev(%class.Test3* %var)
   62   // CHECK64-NEXT: %call2 = call %class.Test3* @"??0Test3@@QEAA@XZ"(%class.Test3* %var)
   63   var.Test3::Test3();
   64 
   65   // CHECK32-NEXT: call x86_thiscallcc void @_ZN5Test3C1ERKS_(%class.Test3* %var, %class.Test3* dereferenceable({{[0-9]+}}) %var2)
   66   // CHECK64-NEXT: %call3 = call %class.Test3* @"??0Test3@@QEAA@AEBV0@@Z"(%class.Test3* %var, %class.Test3* dereferenceable({{[0-9]+}}) %var2)
   67   var.Test3::Test3(var2);
   68 }