simple_with_fun.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 test_a() -> i32 {
  7. return 0;
  8. }
  9. var a: i32 = test_a();
  10. // CHECK:STDOUT: --- simple_with_fun.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: constants {
  13. // CHECK:STDOUT: %test_a: type = fn_type @test_a [template]
  14. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  15. // CHECK:STDOUT: %struct: test_a = struct_value () [template]
  16. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  21. // CHECK:STDOUT: .Core = %Core
  22. // CHECK:STDOUT: .test_a = %test_a.decl
  23. // CHECK:STDOUT: .a = %a
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  26. // CHECK:STDOUT: %test_a.decl: test_a = fn_decl @test_a [template = constants.%struct] {
  27. // CHECK:STDOUT: @test_a.%return: ref i32 = var <return slot>
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %a.var: ref i32 = var a
  30. // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: fn @test_a() -> i32 {
  34. // CHECK:STDOUT: !entry:
  35. // CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2]
  36. // CHECK:STDOUT: return %.loc8
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @__global_init() {
  40. // CHECK:STDOUT: !entry:
  41. // CHECK:STDOUT: %test_a.ref: test_a = name_ref test_a, file.%test_a.decl [template = constants.%struct]
  42. // CHECK:STDOUT: %test_a.call: init i32 = call %test_a.ref()
  43. // CHECK:STDOUT: assign file.%a.var, %test_a.call
  44. // CHECK:STDOUT: return
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: