basic.carbon 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/basic.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/basic.carbon
  10. class C {
  11. var a: i32;
  12. var b: C*;
  13. }
  14. fn F(c: C) -> C;
  15. fn Run() {
  16. var c: C;
  17. var d: C = F(c);
  18. }
  19. // CHECK:STDOUT: ; ModuleID = 'basic.carbon'
  20. // CHECK:STDOUT: source_filename = "basic.carbon"
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: declare void @F(ptr sret({ i32, ptr }), ptr)
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: define void @main() {
  25. // CHECK:STDOUT: entry:
  26. // CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8
  27. // CHECK:STDOUT: %d.var = alloca { i32, ptr }, align 8
  28. // CHECK:STDOUT: call void @F(ptr %d.var, ptr %c.var)
  29. // CHECK:STDOUT: ret void
  30. // CHECK:STDOUT: }