reorder.carbon 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. class Class {
  7. fn G() -> i32 {
  8. return Class.F();
  9. }
  10. fn F() -> i32 {
  11. return 1;
  12. }
  13. }
  14. // CHECK:STDOUT: --- reorder.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  18. // CHECK:STDOUT: %G: type = fn_type @G [template]
  19. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  20. // CHECK:STDOUT: %struct.1: G = struct_value () [template]
  21. // CHECK:STDOUT: %F: type = fn_type @F [template]
  22. // CHECK:STDOUT: %struct.2: F = struct_value () [template]
  23. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  24. // CHECK:STDOUT: %.3: i32 = int_literal 1 [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: file {
  28. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  29. // CHECK:STDOUT: .Core = %Core
  30. // CHECK:STDOUT: .Class = %Class.decl
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  33. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: class @Class {
  37. // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] {
  38. // CHECK:STDOUT: %return.var.loc8: ref i32 = var <return slot>
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {
  41. // CHECK:STDOUT: %return.var.loc12: ref i32 = var <return slot>
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: !members:
  45. // CHECK:STDOUT: .Self = constants.%Class
  46. // CHECK:STDOUT: .G = %G.decl
  47. // CHECK:STDOUT: .F = %F.decl
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: fn @G() -> i32 {
  51. // CHECK:STDOUT: !entry:
  52. // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class]
  53. // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2]
  54. // CHECK:STDOUT: %F.call: init i32 = call %F.ref()
  55. // CHECK:STDOUT: %.loc9_21.1: i32 = value_of_initializer %F.call
  56. // CHECK:STDOUT: %.loc9_21.2: i32 = converted %F.call, %.loc9_21.1
  57. // CHECK:STDOUT: return %.loc9_21.2
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: fn @F() -> i32 {
  61. // CHECK:STDOUT: !entry:
  62. // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3]
  63. // CHECK:STDOUT: return %.loc13
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT: