brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · ab44f43 Raw
32 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm --std=c++17 %s -o - | FileCheck %s2 3struct stream {4  friend const stream &operator<<(const stream &, const float &);5};6 7void foo() {8  constexpr float f_zero = 0.0f;9  constexpr float f_one = 1.0f;10  constexpr float f_two = 2.0f;11 12  stream s;13  [=]() {14    s << f_zero << f_one << f_two;15  }();16}17 18// CHECK: define{{.*}} void @_Z3foov19// CHECK:      getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 120// CHECK-NEXT: store float 0.00021// CHECK-NEXT: getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 222// CHECK-NEXT: store float 1.00023// CHECK-NEXT: getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 324// CHECK-NEXT: store float 2.00025 26// The lambda body.  Reverse iteration when the captures aren't deterministic27// causes these to be laid out differently in the lambda.28// CHECK: define internal void29// CHECK: getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 130// CHECK: getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 231// CHECK: getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 332