struct.carbon 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. fn Main() -> {.a: i32} {
  7. return {.a = 3};
  8. }
  9. // CHECK:STDOUT: --- struct.carbon
  10. // CHECK:STDOUT:
  11. // CHECK:STDOUT: constants {
  12. // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template]
  13. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  14. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  15. // CHECK:STDOUT: %struct.1: Main = struct_value () [template]
  16. // CHECK:STDOUT: %.3: i32 = int_literal 3 [template]
  17. // CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .Core = %Core
  23. // CHECK:STDOUT: .Main = %Main.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  26. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {
  27. // CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1]
  28. // CHECK:STDOUT: @Main.%return: ref {.a: i32} = var <return slot>
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: fn @Main() -> {.a: i32} {
  33. // CHECK:STDOUT: !entry:
  34. // CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.3]
  35. // CHECK:STDOUT: %.loc8_17: {.a: i32} = struct_literal (%.loc8_16)
  36. // CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct.2]
  37. // CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct.2]
  38. // CHECK:STDOUT: return %.loc8_18
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: