| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/global/class_with_fun.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/global/class_with_fun.carbon
- class A {}
- fn ret_a() -> A {
- return {};
- }
- var a: A = {};
- // CHECK:STDOUT: ; ModuleID = 'class_with_fun.carbon'
- // CHECK:STDOUT: source_filename = "class_with_fun.carbon"
- // CHECK:STDOUT:
- // CHECK:STDOUT: @a = internal global {}
- // CHECK:STDOUT: @struct.loc13_12 = internal constant {} zeroinitializer
- // CHECK:STDOUT: @struct.loc16_14 = internal constant {} zeroinitializer
- // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__global_init, ptr null }]
- // CHECK:STDOUT:
- // CHECK:STDOUT: define void @ret_a(ptr sret({}) %return) {
- // CHECK:STDOUT: entry:
- // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @struct.loc13_12, i64 0, i1 false)
- // CHECK:STDOUT: ret void
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: define void @__global_init() {
- // CHECK:STDOUT: entry:
- // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @a, ptr align 1 @struct.loc16_14, i64 0, i1 false)
- // CHECK:STDOUT: ret void
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
- // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
- // CHECK:STDOUT:
- // CHECK:STDOUT: ; uselistorder directives
- // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 }
- // CHECK:STDOUT:
- // CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
|